Fix ids mixing between timesheet and project works

review915002
(transplanted from a45802fb6088de85f0a07b0dd06b10391a43ada1)
This commit is contained in:
Cédric Krier committed 2013-06-07 19:24:34 +02:00
1 parent 29e91f643a
commit 8c18fa208a
1 file changed
+4 -2
+4 -2
View File
@@ -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