c2c-oerpscenario team mailing list archive
-
c2c-oerpscenario team
-
Mailing list archive
-
Message #29709
[Bug 803979] Re: project_timesheet: inherited project.task write def updates all work entries
I'm sorry Amit, but you should read my explanations a little more
carefully to reproduce the bug before you try to show something else and
deny it.
Your reproduction (video) does not clearly show at all the non-existence
of the bug I've described. It is not that easy to reproduce this bug
although I may understand that OpenERP SA does not have the time to fix
nor to reproduce this bug yet. Nevertheless, I think this bug should be
fixed some time (I will reproduce it again maybe later and easier to
follow)
Best regards
Wolfgang
--
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/803979
Title:
project_timesheet: inherited project.task write def updates all work
entries
Status in OpenERP Modules (addons):
Invalid
Bug description:
It is not possible to write a specific task work (in an module which
calls project.task write and wants to trigger an update of analytic
timesheet)
It will always run into an exception when work entries of a task are
already in a confirmed state because the for loop tries to update ALL
work entries instead of specific ones.
I compared the mechanism of the task view and rebuilt the vals
structure and added an if condition...probably the else could be
eliminated but this should be evaluated before :-)
def write(self, cr, uid, ids,vals,context=None):
if context is None:
context = {}
if vals.get('project_id',False) or vals.get('name',False):
vals_line = {}
hr_anlytic_timesheet = self.pool.get('hr.analytic.timesheet')
task_obj_l = self.browse(cr, uid, ids, context=context)
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
if 'work_ids' in vals:
for work in vals['work_ids']:
task_work = self.pool.get('project.task.work').browse(cr, uid, [work[1]])[0]
if not task_work.hr_analytic_timesheet_id:
continue
line_id = task_work.hr_analytic_timesheet_id
if vals.get('project_id',False):
vals_line['account_id'] = acc_id
if vals.get('name',False):
vals_line['name'] = '%s: %s' % (tools.ustr(vals['name']), tools.ustr(task_work.name) or '/')
hr_anlytic_timesheet.write(cr, uid, [line_id.id], vals_line, {})
else:
for task_obj in task_obj_l:
if len(task_obj.work_ids):
for task_work in task_obj.work_ids:
if not task_work.hr_analytic_timesheet_id:
continue
line_id = task_work.hr_analytic_timesheet_id.id
if vals.get('project_id',False):
vals_line['account_id'] = acc_id
if vals.get('name',False):
vals_line['name'] = '%s: %s' % (tools.ustr(vals['name']), tools.ustr(task_work.name) or '/')
hr_anlytic_timesheet.write(cr, uid, [line_id], vals_line, {})
return super(task,self).write(cr, uid, ids, vals, context)
Hope you were able to follow :-)
Best regards,
Wolfgang
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/803979/+subscriptions
References