From 22882a39a3d422af9972747af74e41ff58dd4357 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Mon, 23 Mar 2009 22:12:44 +0100 Subject: [PATCH] modifs bzr revid: fp@tinyerp.com-20090323211244-hmihn3zlvk3xu5g7 --- addons/project_timesheet/project_timesheet.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/addons/project_timesheet/project_timesheet.py b/addons/project_timesheet/project_timesheet.py index 8b41c6d87d5..6b548af328f 100644 --- a/addons/project_timesheet/project_timesheet.py +++ b/addons/project_timesheet/project_timesheet.py @@ -93,12 +93,9 @@ class project_work(osv.osv): return super(project_work,self).write(cr, uid, ids, vals, context) def unlink(self, cr, uid, ids, *args, **kwargs): - timesheet_id = self.pool.get('project.task.work').browse(cr, uid, ids)[0].hr_analytic_timesheet_id - delete entry from timesheet too while deleting entry to task. - list_avail_ids = self.pool.get('hr.analytic.timesheet').search(cr, uid, []) - if timesheet_id in list_avail_ids: - obj = self.pool.get('hr.analytic.timesheet').unlink(cr, uid, [timesheet_id], *args, **kwargs) - + for timesheet_id in self.pool.get('project.task.work').browse(cr, uid, ids): + if timesheet_id.hr_analytic_timesheet_id: + obj = self.pool.get('hr.analytic.timesheet').unlink(cr, uid, [timesheet_id.hr_analytic_timesheet_id.id], *args, **kwargs) return super(project_work,self).unlink(cr, uid, ids, *args, **kwargs) _columns={