From c1335de421376363a1d937962498ca82d995e014 Mon Sep 17 00:00:00 2001 From: "uco (Open ERP)" Date: Wed, 28 Jul 2010 12:52:38 +0530 Subject: [PATCH] [REF] mrp_operations: Code refactored. bzr revid: uco@tinyerp.com-20100728072238-37tfpoewfu8xnwg5 --- addons/mrp_operations/mrp_operations.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/mrp_operations/mrp_operations.py b/addons/mrp_operations/mrp_operations.py index 927a0f2a494..5fbbc5ea18a 100644 --- a/addons/mrp_operations/mrp_operations.py +++ b/addons/mrp_operations/mrp_operations.py @@ -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)