[IMP] base_calendar: performance improvement in project.task (progress field)

bzr revid: olt@tinyerp.com-20100924131709-cqsd1ut234ni6txn
This commit is contained in:
olt@tinyerp.com 2010-09-24 15:17:09 +02:00
parent 0c20778e1c
commit 937d8fe330
1 changed files with 5 additions and 1 deletions

View File

@ -1531,8 +1531,12 @@ true, it will allow you to hide the event alarm information without removing it.
result = []
if fields and 'date' not in fields:
fields.append('date')
real_ids = [item2 for item1, item2 in select]
event_values = dict([(res['id'], res) for res in super(calendar_event, self).read(cr, uid, real_ids, fields=fields, context=context, load=load)])
for base_calendar_id, real_id in select:
res = super(calendar_event, self).read(cr, uid, real_id, fields=fields, context=context, load=load)
res = event_values[real_id]
ls = base_calendar_id2real_id(base_calendar_id, with_date=res and res.get('duration', 0) or 0)
if not isinstance(ls, (str, int, long)) and len(ls) >= 2:
res['date'] = ls[1]