[FIX] project_timesheet: fixed regression if task does not has project
bzr revid: hmo@tinyerp.com-20101012120850-h4nd4w3mf30ck8hr
This commit is contained in:
parent
258e6edff6
commit
467edb6094
|
@ -82,7 +82,8 @@ class project_work(osv.osv):
|
|||
user_uom, default_uom = project_obj._get_user_and_default_uom_ids(cr, uid)
|
||||
if result['product_uom_id'] != default_uom:
|
||||
vals_line['unit_amount'] = uom_obj._compute_qty(cr, uid, default_uom, vals['hours'], result['product_uom_id'])
|
||||
acc_id = obj_task.project_id.analytic_account_id.id
|
||||
acc_id = obj_task.project_id and obj_task.project_id.analytic_account_id.id or False
|
||||
if acc_id:
|
||||
vals_line['account_id'] = acc_id
|
||||
res = obj_timesheet.on_change_account_id(cr, uid, False, acc_id)
|
||||
if res.get('value'):
|
||||
|
@ -196,6 +197,8 @@ class task(osv.osv):
|
|||
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
|
||||
|
|
Loading…
Reference in New Issue