[FIX] project_timesheet: analytic entries are fully not updated, when changing task project

lp bug: https://launchpad.net/bugs/464578 fixed

bzr revid: mra@tinyerp.com-20091208065231-gdg25kftb19cxvh6
This commit is contained in:
VRA (OpenERP) 2009-12-08 12:22:31 +05:30 committed by mra (Open ERP)
parent c8d93b4cfc
commit 118b2b05a2
1 changed files with 26 additions and 0 deletions

View File

@ -125,6 +125,32 @@ class project_work(osv.osv):
project_work()
class task(osv.osv):
_inherit = "project.task"
_description = "Tasks"
def write(self, cr, uid, ids,vals,context={}):
if (vals.has_key('project_id') and vals['project_id']) or (vals.has_key('name') and vals['name']):
vals_line = {}
hr_anlytic_timesheet = self.pool.get('hr.analytic.timesheet')
task_obj_l = self.browse(cr, uid, ids, context)
if (vals.has_key('project_id') and vals['project_id']):
project_obj = self.pool.get('project.project').browse(cr, uid, vals['project_id'])
acc_id = project_obj.category_id.id
for task in task_obj_l:
if len(task.work_ids):
for task_work in task.work_ids:
line_id = task_work.hr_analytic_timesheet_id
if (vals.has_key('project_id') and vals['project_id']):
vals_line['account_id'] = acc_id
if (vals.has_key('name') and vals['name']):
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(osv.osv,self).write(cr, uid, ids, vals, context)
task()
class project_project(osv.osv):
_inherit = "project.project"
def name_get(self, cr, user, ids, context=None):