[FIX] mrp_operations: Fixed date error.

bzr revid: uco@tinyerp.com-20101012120344-doogkiibwzo9g8d3
This commit is contained in:
uco (OpenERP) 2010-10-12 17:33:44 +05:30
parent 937099fef2
commit 46a478c315
1 changed files with 8 additions and 3 deletions

View File

@ -67,14 +67,19 @@ class mrp_production_workcenter_line(osv.osv):
@return: Dictionary of values.
"""
ops = self.browse(cr, uid, ids, context=context)
date_and_hours_by_cal = [(op.production_id.date_planned, op.hour, op.workcenter_id.calendar_id.id) for op in ops]
date_and_hours_by_cal = []
for op in ops:
date_planned = op.production_id.date_planned and op.date_planned
if date_planned:
date_and_hours_by_cal.append((date_planned, op.hour, op.workcenter_id.calendar_id.id))
intervals = self.pool.get('resource.calendar').interval_get_multi(cr, uid, date_and_hours_by_cal)
res = {}
for op in ops:
res[op.id] = False
if op.date_planned:
i = intervals[(op.date_planned, op.hour, op.workcenter_id.calendar_id.id)]
date_planned = op.production_id.date_planned and op.date_planned
if date_planned:
i = intervals[(date_planned, op.hour, op.workcenter_id.calendar_id.id)]
if i:
res[op.id] = i[-1][1].strftime('%Y-%m-%d %H:%M:%S')
else: