From 4bd080e1747447170fee7156f572b01c30ec6c70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 7 Feb 2016 16:09:04 +0100 Subject: [PATCH] Fix timesheet methods when project has no timesheet work issue5260 review21631002 --- work.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/work.py b/work.py index 2ce85f779c..cf8b05fd9b 100644 --- a/work.py +++ b/work.py @@ -307,7 +307,7 @@ class Work: line = TimesheetLine.__table__() durations = {} - twork2work = dict((w.work.id, w.id) for w in works) + twork2work = dict((w.work.id, w.id) for w in works if w.work) ids = twork2work.keys() for sub_ids in grouped_slice(ids): red_sql = reduce_ids(line.work, sub_ids) @@ -509,7 +509,7 @@ class Work: return [] def _get_lines_to_invoice_timesheet(self): - if self.work.timesheet_lines: + if self.work and self.work.timesheet_lines: if not self.product: self.raise_user_error('missing_product', (self.rec_name,)) elif self.list_price is None: