Arnaud Pineux (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-1023047-api into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #1023047 in OpenERP Addons: "can't add new work to task if there's 
already work for a confirm/done timesheet"
  https://bugs.launchpad.net/openobject-addons/+bug/1023047

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1023047-api/+merge/133422

In Project_Timesheet/project_timesheet.py
At line 203: self.pool.get('hr.analytic.timesheet').write(cr, uid, 
[line_id.id], vals_line, context=context)
was replaced by: 
state = 
self.pool.get('hr.analytic.timesheet').browse(cr,uid,line_id.id,context=context).sheet_id.state
if state != 'confirm' and state != 'done':
     self.pool.get('hr.analytic.timesheet').write(cr, uid, [line_id.id], 
vals_line, context=context)

-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1023047-api/+merge/133422
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-1023047-api.
=== modified file 'project_timesheet/project_timesheet.py'
--- project_timesheet/project_timesheet.py	2012-10-29 05:45:52 +0000
+++ project_timesheet/project_timesheet.py	2012-11-08 08:39:25 +0000
@@ -199,8 +199,9 @@
 
                 if amount_unit and 'amount' in amount_unit.get('value',{}):
                     vals_line['amount'] = amount_unit['value']['amount']
-
-            self.pool.get('hr.analytic.timesheet').write(cr, uid, [line_id.id], vals_line, context=context)
+            state = self.pool.get('hr.analytic.timesheet').browse(cr,uid,line_id.id,context=context).sheet_id.state
+            if state != 'confirm' and state != 'done':
+                self.pool.get('hr.analytic.timesheet').write(cr, uid, [line_id.id], vals_line, context=context)
 
         return super(project_work,self).write(cr, uid, ids, vals, context)
 
@@ -241,7 +242,6 @@
             if vals.get('project_id',False):
                 project_obj = self.pool.get('project.project').browse(cr, uid, vals['project_id'], context=context)
                 acc_id = project_obj.analytic_account_id.id
-
             for task_obj in self.browse(cr, uid, ids, context=context):
                 if len(task_obj.work_ids):
                     for task_work in task_obj.work_ids:

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to