From 8c18fa208a0aa6aa33d51b119479aeb41d41c19b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 7 Jun 2013 19:24:34 +0200 Subject: [PATCH] Fix ids mixing between timesheet and project works review915002 (transplanted from a45802fb6088de85f0a07b0dd06b10391a43ada1) --- work.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/work.py b/work.py index 1b7ea0231d..b237dde02b 100644 --- a/work.py +++ b/work.py @@ -185,7 +185,8 @@ class Work: cursor = Transaction().cursor hours = {} - ids = [w.id for w in works] + twork2work = dict((w.work.id, w.id) for w in works) + ids = twork2work.keys() for i in range(0, len(ids), cursor.IN_MAX): sub_ids = ids[i:i + cursor.IN_MAX] red_sql, red_ids = reduce_ids('work', sub_ids) @@ -195,7 +196,8 @@ class Work: 'AND invoice_line IS ' + ( 'NOT NULL ' if invoiced else 'NULL ') + 'GROUP BY work', red_ids) - hours.update(dict(i for i in cursor.fetchall())) + hours.update(dict((twork2work[w], h) + for w, h in cursor.fetchall())) return hours @classmethod