[REF] mrp_operations: Code refactored.
bzr revid: uco@tinyerp.com-20100728072238-37tfpoewfu8xnwg5
This commit is contained in:
parent
b7d2c68778
commit
c1335de421
|
@ -136,13 +136,14 @@ class mrp_production_workcenter_line(osv.osv):
|
|||
|
||||
def write(self, cr, uid, ids, vals, context={}, update=True):
|
||||
result = super(mrp_production_workcenter_line, self).write(cr, uid, ids, vals, context=context)
|
||||
prod_obj = self.pool.get('mrp.production')
|
||||
if vals.get('date_planned', False) and update:
|
||||
pids = {}
|
||||
pids2 = {}
|
||||
for prod in self.browse(cr, uid, ids, context=context):
|
||||
if prod.production_id.workcenter_lines:
|
||||
dstart = min(vals['date_planned'], prod.production_id.workcenter_lines[0]['date_planned'])
|
||||
self.pool.get('mrp.production').write(cr, uid, [prod.production_id.id], {'date_start':dstart}, context=context, mini=False)
|
||||
prod_obj.write(cr, uid, [prod.production_id.id], {'date_start':dstart}, context=context, mini=False)
|
||||
return result
|
||||
|
||||
def action_draft(self, cr, uid, ids):
|
||||
|
@ -222,8 +223,8 @@ class mrp_production(osv.osv):
|
|||
@return: Super method
|
||||
"""
|
||||
obj = self.browse(cr, uid, ids)[0]
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for workcenter_line in obj.workcenter_lines:
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', workcenter_line.id, 'button_done', cr)
|
||||
return super(mrp_production,self).action_production_end(cr, uid, ids)
|
||||
|
||||
|
@ -232,9 +233,8 @@ class mrp_production(osv.osv):
|
|||
@return: True
|
||||
"""
|
||||
obj = self.browse(cr, uid, ids)[0]
|
||||
workcenter_line_obj = self.pool.get('mrp.production.workcenter.line')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for workcenter_line in obj.workcenter_lines:
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', workcenter_line.id, 'button_start_working', cr)
|
||||
return super(mrp_production,self).action_in_production(cr, uid, ids)
|
||||
|
||||
|
@ -243,8 +243,8 @@ class mrp_production(osv.osv):
|
|||
@return: Super method
|
||||
"""
|
||||
obj = self.browse(cr, uid, ids)[0]
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for workcenter_line in obj.workcenter_lines:
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'mrp.production.workcenter.line', workcenter_line.id, 'button_cancel', cr)
|
||||
return super(mrp_production,self).action_cancel(cr,uid,ids)
|
||||
|
||||
|
|
Loading…
Reference in New Issue