Merge lp:~vauxoo/addons-vauxoo/7.0-project_task_work-onchange_date_hours-jc into lp:addons-vauxoo/7.0

Proposed by Juan Carlos Hernandez
Status: Merged
Merged at revision: 1064
Proposed branch: lp:~vauxoo/addons-vauxoo/7.0-project_task_work-onchange_date_hours-jc
Merge into: lp:addons-vauxoo/7.0
Diff against target: 85 lines (+43/-2)
2 files modified
project_task_work/model/project_task_work.py (+18/-2)
project_task_work/view/project_view.xml (+25/-0)
To merge this branch: bzr merge lp:~vauxoo/addons-vauxoo/7.0-project_task_work-onchange_date_hours-jc
Reviewer Review Type Date Requested Status
Sabrina Romero - http://www.vauxoo.com Approve
Julio Serna-http://www.vauxoo.com Approve
Juan Carlos Hernandez Needs Resubmitting
Moisés López - http://www.vauxoo.com Pending
Review via email: mp+224379@code.launchpad.net

Description of the change

se agregó validación para las horas de las tareas y para la fecha de la misma ,avisando con una advertencia, pero si pueden guardar los datos.

To post a comment you must log in.
Revision history for this message
Juan Carlos Hernandez (openerp1) wrote :

ademas se puso como requerido el campo project_id desde la vista

review: Needs Resubmitting
1061. By Juan Carlos Hernandez

[IMP][project_task_work]change message

Revision history for this message
Sabrina Romero - http://www.vauxoo.com (sabrina) wrote :

@Julio @Moi,

Me da alguno su Vo. Bo. sobre esta propuesta antes de mergear?, funcionalmente hace lo indicado.

Revision history for this message
Julio Serna-http://www.vauxoo.com (hearthebreaker) :
1062. By Juan Carlos Hernandez

[IMP][project_task_work]remove ¿ on message

Revision history for this message
Julio Serna-http://www.vauxoo.com (hearthebreaker) :
review: Approve
Revision history for this message
Sabrina Romero - http://www.vauxoo.com (sabrina) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'project_task_work/model/project_task_work.py'
--- project_task_work/model/project_task_work.py 2014-05-09 21:51:34 +0000
+++ project_task_work/model/project_task_work.py 2014-06-25 23:19:58 +0000
@@ -31,12 +31,12 @@
31class project_task(osv.Model):31class project_task(osv.Model):
32 _inherit = 'project.task'32 _inherit = 'project.task'
3333
34
34 def _get_issue(self, cr, uid, ids, fieldname, arg, context=None):35 def _get_issue(self, cr, uid, ids, fieldname, arg, context=None):
35 if context is None:36 if context is None:
36 context = {}37 context = {}
37 res = {}38 res = {}
38 pi_obj = self.pool.get('project.issue')39 pi_obj = self.pool.get('project.issue')
39
40 for id in ids:40 for id in ids:
41 pi_ids = pi_obj.search(cr, uid, [('task_id', '=', id)]) or []41 pi_ids = pi_obj.search(cr, uid, [('task_id', '=', id)]) or []
42 res[id] = pi_ids and pi_ids[0] or None42 res[id] = pi_ids and pi_ids[0] or None
@@ -67,6 +67,22 @@
6767
68class project_task_work(osv.Model):68class project_task_work(osv.Model):
69 _inherit = 'project.task.work'69 _inherit = 'project.task.work'
70
71 def onchange_hours(self, cr, uid, ids, hours=None, context=None):
72 if context is None:
73 context = {}
74 warning = {}
75 if hours < 0:
76 warning = { 'title': _('Warning!'), 'message': _('Are you sure that you want to charge hours in negative?')}
77 return { 'warning': warning}
78
79 def onchange_date(self, cr, uid, ids, date=None, context=None):
80 if context is None:
81 context = {}
82 warning = {}
83 if date > time.strftime('%Y-%m-%d %H:%M:%S'):
84 warning = { 'title': _('Warning!'), 'message': _('Are you sure that you want to charge a future date?')}
85 return { 'warning': warning}
7086
71 def _get_project(self, cr, uid, ids, fieldname, arg, context=None):87 def _get_project(self, cr, uid, ids, fieldname, arg, context=None):
72 if context is None:88 if context is None:
@@ -74,7 +90,7 @@
74 res = {}.fromkeys(ids,None)90 res = {}.fromkeys(ids,None)
75 ids = self.exists(cr, uid, ids, context=context)91 ids = self.exists(cr, uid, ids, context=context)
76 for ptw_brw in self.browse(cr, uid, ids, context=context):92 for ptw_brw in self.browse(cr, uid, ids, context=context):
7793
78 res[ptw_brw.id] = \94 res[ptw_brw.id] = \
79 ptw_brw.task_id and \95 ptw_brw.task_id and \
80 (ptw_brw.task_id.issue_id and96 (ptw_brw.task_id.issue_id and
8197
=== modified file 'project_task_work/view/project_view.xml'
--- project_task_work/view/project_view.xml 2013-04-26 08:14:35 +0000
+++ project_task_work/view/project_view.xml 2014-06-25 23:19:58 +0000
@@ -1,6 +1,31 @@
1<?xml version='1.0' encoding='UTF-8'?>1<?xml version='1.0' encoding='UTF-8'?>
2<openerp>2<openerp>
3 <data>3 <data>
4
5 <record model="ir.ui.view" id="view_project_task_form2_inherit_0">
6 <field name="name">view.project.task.form2.inherit0</field>
7 <field name="model">project.task</field>
8 <field name="inherit_id" ref="project.view_task_form2"/>
9 <field name="arch" type="xml">
10 <xpath expr="//field[@name='project_id']" position="replace">
11 <field name="project_id" domain="[('state', '!=', 'close')]" on_change="onchange_project(project_id)" context="{'default_use_tasks':1}" required="1"/>
12 </xpath>
13 </field>
14 </record>
15
16 <record model="ir.ui.view" id="view_project_task_form2_inherit_onchange">
17 <field name="name">view.project.task.form2.inherit_onchange</field>
18 <field name="model">project.task</field>
19 <field name="inherit_id" ref="project.view_task_form2"/>
20 <field name="arch" type="xml">
21 <xpath expr="//notebook/page[@string='Description']/field[@name='work_ids']/tree[@string='Task Work']/field[@name='hours']" position="replace">
22 <field name="hours" widget="float_time" sum="Spent Hours" on_change="onchange_hours(hours)"/>
23 </xpath>
24 <xpath expr="//notebook/page[@string='Description']/field[@name='work_ids']/tree[@string='Task Work']/field[@name='date']" position="replace">
25 <field name="date" on_change="onchange_date(date)"/>
26 </xpath>
27 </field>
28 </record>
429
530
6 <record id="view_project_task_work_ext_tree" model="ir.ui.view">31 <record id="view_project_task_work_ext_tree" model="ir.ui.view">