Merge lp:~vauxoo/addons-vauxoo/7.0_project_domain_task_moved_code_jc into lp:addons-vauxoo/7.0

Proposed by Juan Carlos Hernandez
Status: Merged
Merged at revision: 1072
Proposed branch: lp:~vauxoo/addons-vauxoo/7.0_project_domain_task_moved_code_jc
Merge into: lp:addons-vauxoo/7.0
Diff against target: 217 lines (+94/-46)
7 files modified
project_task_domain/__init__.py (+2/-1)
project_task_domain/__openerp__.py (+2/-1)
project_task_domain/model/__init__.py (+27/-0)
project_task_domain/model/project_task_work.py (+49/-0)
project_task_domain/view/project_task_view_inherit.xml (+14/-0)
project_task_work/model/project_task_work.py (+0/-17)
project_task_work/view/project_view.xml (+0/-27)
To merge this branch: bzr merge lp:~vauxoo/addons-vauxoo/7.0_project_domain_task_moved_code_jc
Reviewer Review Type Date Requested Status
Jorge Angel Naranjo Rogel - http://www.vauxoo.com Pending
Juan Carlos Hernandez Pending
Sabrina Romero - http://www.vauxoo.com Pending
Review via email: mp+225720@code.launchpad.net

Description of the change

se cambió el código de los cambios del campo project como requerido y los onchanges que validan las horas negativas y fechas futuras del modulo project_task_work al modulo project_task_domain

To post a comment you must log in.
1073. By Juan Carlos Hernandez

[IMP][project_task_domain]add import time

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'project_task_domain/__init__.py'
2--- project_task_domain/__init__.py 2014-06-26 22:55:50 +0000
3+++ project_task_domain/__init__.py 2014-07-04 21:38:12 +0000
4@@ -23,4 +23,5 @@
5 # You should have received a copy of the GNU Affero General Public License
6 # along with this program. If not, see <http://www.gnu.org/licenses/>.
7 #
8-#
9\ No newline at end of file
10+#
11+import model
12\ No newline at end of file
13
14=== modified file 'project_task_domain/__openerp__.py'
15--- project_task_domain/__openerp__.py 2014-06-26 22:55:50 +0000
16+++ project_task_domain/__openerp__.py 2014-07-04 21:38:12 +0000
17@@ -26,13 +26,14 @@
18 #
19
20 {
21- "name": "Project domain project_id",
22+ "name": "Project Required",
23 "version": "1.0",
24 "author": "Vauxoo",
25 "category": "Generic Modules/Project",
26 "description" : """
27 This module set as required the field project_id on
28 model project.task from the view by inheritance.
29+ Also warns the hours and add negative future dates.
30 """,
31 "website": "http://www.vauxoo.com/",
32 "license": "AGPL-3",
33
34=== added directory 'project_task_domain/model'
35=== added file 'project_task_domain/model/__init__.py'
36--- project_task_domain/model/__init__.py 1970-01-01 00:00:00 +0000
37+++ project_task_domain/model/__init__.py 2014-07-04 21:38:12 +0000
38@@ -0,0 +1,27 @@
39+#!/usr/bin/python
40+# -*- encoding: utf-8 -*-
41+#
42+# Module Writen to OpenERP, Open Source Management Solution
43+#
44+# Copyright (c) 2014 Vauxoo - http://www.vauxoo.com/
45+# All Rights Reserved.
46+# info Vauxoo (info@vauxoo.com)
47+#
48+# Coded by: vauxoo consultores (info@vauxoo.com)
49+#
50+#
51+# This program is free software: you can redistribute it and/or modify
52+# it under the terms of the GNU Affero General Public License as
53+# published by the Free Software Foundation, either version 3 of the
54+# License, or (at your option) any later version.
55+#
56+# This program is distributed in the hope that it will be useful,
57+# but WITHOUT ANY WARRANTY; without even the implied warranty of
58+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
59+# GNU Affero General Public License for more details.
60+#
61+# You should have received a copy of the GNU Affero General Public License
62+# along with this program. If not, see <http://www.gnu.org/licenses/>.
63+#
64+#
65+import project_task_work
66
67=== added file 'project_task_domain/model/project_task_work.py'
68--- project_task_domain/model/project_task_work.py 1970-01-01 00:00:00 +0000
69+++ project_task_domain/model/project_task_work.py 2014-07-04 21:38:12 +0000
70@@ -0,0 +1,49 @@
71+#!/usr/bin/python
72+# -*- encoding: utf-8 -*-
73+#
74+# Module Writen to OpenERP, Open Source Management Solution
75+#
76+# Copyright (c) 2014 Vauxoo - http://www.vauxoo.com/
77+# All Rights Reserved.
78+# info Vauxoo (info@vauxoo.com)
79+#
80+# Coded by: vauxoo consultores (info@vauxoo.com)
81+#
82+#
83+# This program is free software: you can redistribute it and/or modify
84+# it under the terms of the GNU Affero General Public License as
85+# published by the Free Software Foundation, either version 3 of the
86+# License, or (at your option) any later version.
87+#
88+# This program is distributed in the hope that it will be useful,
89+# but WITHOUT ANY WARRANTY; without even the implied warranty of
90+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
91+# GNU Affero General Public License for more details.
92+#
93+# You should have received a copy of the GNU Affero General Public License
94+# along with this program. If not, see <http://www.gnu.org/licenses/>.
95+#
96+#
97+from openerp.osv import osv, fields
98+from openerp.tools.translate import _
99+import time
100+
101+
102+class project_task_work(osv.Model):
103+ _inherit = 'project.task.work'
104+
105+ def onchange_hours(self, cr, uid, ids, hours=None, context=None):
106+ if context is None:
107+ context = {}
108+ warning = {}
109+ if hours < 0:
110+ warning = { 'title': _('Warning!'), 'message': _('Are you sure that you want to charge hours in negative?')}
111+ return { 'warning': warning}
112+
113+ def onchange_date(self, cr, uid, ids, date=None, context=None):
114+ if context is None:
115+ context = {}
116+ warning = {}
117+ if date > time.strftime('%Y-%m-%d %H:%M:%S'):
118+ warning = { 'title': _('Warning!'), 'message': _('Are you sure that you want to charge a future date?')}
119+ return { 'warning': warning}
120\ No newline at end of file
121
122=== modified file 'project_task_domain/view/project_task_view_inherit.xml'
123--- project_task_domain/view/project_task_view_inherit.xml 2014-06-26 22:55:50 +0000
124+++ project_task_domain/view/project_task_view_inherit.xml 2014-07-04 21:38:12 +0000
125@@ -11,5 +11,19 @@
126 </xpath>
127 </field>
128 </record>
129+
130+ <record model="ir.ui.view" id="view_project_task_form2_inherit_onchange">
131+ <field name="name">view.project.task.form2.inherit_onchange</field>
132+ <field name="model">project.task</field>
133+ <field name="inherit_id" ref="project.view_task_form2"/>
134+ <field name="arch" type="xml">
135+ <xpath expr="//notebook/page[@string='Description']/field[@name='work_ids']/tree[@string='Task Work']/field[@name='hours']" position="replace">
136+ <field name="hours" widget="float_time" sum="Spent Hours" on_change="onchange_hours(hours)"/>
137+ </xpath>
138+ <xpath expr="//notebook/page[@string='Description']/field[@name='work_ids']/tree[@string='Task Work']/field[@name='date']" position="replace">
139+ <field name="date" on_change="onchange_date(date)"/>
140+ </xpath>
141+ </field>
142+ </record>
143 </data>
144 </openerp>
145
146=== modified file 'project_task_work/model/project_task_work.py'
147--- project_task_work/model/project_task_work.py 2014-06-25 23:15:07 +0000
148+++ project_task_work/model/project_task_work.py 2014-07-04 21:38:12 +0000
149@@ -67,22 +67,6 @@
150
151 class project_task_work(osv.Model):
152 _inherit = 'project.task.work'
153-
154- def onchange_hours(self, cr, uid, ids, hours=None, context=None):
155- if context is None:
156- context = {}
157- warning = {}
158- if hours < 0:
159- warning = { 'title': _('Warning!'), 'message': _('Are you sure that you want to charge hours in negative?')}
160- return { 'warning': warning}
161-
162- def onchange_date(self, cr, uid, ids, date=None, context=None):
163- if context is None:
164- context = {}
165- warning = {}
166- if date > time.strftime('%Y-%m-%d %H:%M:%S'):
167- warning = { 'title': _('Warning!'), 'message': _('Are you sure that you want to charge a future date?')}
168- return { 'warning': warning}
169
170 def _get_project(self, cr, uid, ids, fieldname, arg, context=None):
171 if context is None:
172@@ -90,7 +74,6 @@
173 res = {}.fromkeys(ids,None)
174 ids = self.exists(cr, uid, ids, context=context)
175 for ptw_brw in self.browse(cr, uid, ids, context=context):
176-
177 res[ptw_brw.id] = \
178 ptw_brw.task_id and \
179 (ptw_brw.task_id.issue_id and
180
181=== modified file 'project_task_work/view/project_view.xml'
182--- project_task_work/view/project_view.xml 2014-06-25 01:43:57 +0000
183+++ project_task_work/view/project_view.xml 2014-07-04 21:38:12 +0000
184@@ -1,33 +1,6 @@
185 <?xml version='1.0' encoding='UTF-8'?>
186 <openerp>
187 <data>
188-
189- <record model="ir.ui.view" id="view_project_task_form2_inherit_0">
190- <field name="name">view.project.task.form2.inherit0</field>
191- <field name="model">project.task</field>
192- <field name="inherit_id" ref="project.view_task_form2"/>
193- <field name="arch" type="xml">
194- <xpath expr="//field[@name='project_id']" position="replace">
195- <field name="project_id" domain="[('state', '!=', 'close')]" on_change="onchange_project(project_id)" context="{'default_use_tasks':1}" required="1"/>
196- </xpath>
197- </field>
198- </record>
199-
200- <record model="ir.ui.view" id="view_project_task_form2_inherit_onchange">
201- <field name="name">view.project.task.form2.inherit_onchange</field>
202- <field name="model">project.task</field>
203- <field name="inherit_id" ref="project.view_task_form2"/>
204- <field name="arch" type="xml">
205- <xpath expr="//notebook/page[@string='Description']/field[@name='work_ids']/tree[@string='Task Work']/field[@name='hours']" position="replace">
206- <field name="hours" widget="float_time" sum="Spent Hours" on_change="onchange_hours(hours)"/>
207- </xpath>
208- <xpath expr="//notebook/page[@string='Description']/field[@name='work_ids']/tree[@string='Task Work']/field[@name='date']" position="replace">
209- <field name="date" on_change="onchange_date(date)"/>
210- </xpath>
211- </field>
212- </record>
213-
214-
215 <record id="view_project_task_work_ext_tree" model="ir.ui.view">
216 <field name="name">project.task.work.ext.tree</field>
217 <field name="model">project.task.work</field>