Fix timesheet methods when project has no timesheet work

issue5260
review21631002
This commit is contained in:
Cédric Krier committed 2016-02-07 16:09:04 +01:00
1 parent 6ad1c8f97a
commit 4bd080e174
1 file changed
+2 -2
+2 -2
View File
@@ -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: