From 5249b531cd0c2d550556c77bedc4e8cb46508c89 Mon Sep 17 00:00:00 2001 From: uco Date: Thu, 15 Jul 2010 16:02:13 +0530 Subject: [PATCH 01/44] [IMP] mrp, mrp_operations: Improved code and removed unnecessary statements. bzr revid: uco@tinyerp.com-20100715103213-m0bhsv98dhm0ap6r --- addons/mrp/mrp.py | 6 ++++-- addons/mrp_operations/mrp_operations.py | 8 +------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index 13ded3a9694..a3eee0af65a 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -561,12 +561,14 @@ class mrp_production(osv.osv): if not product: return {'value': { 'product_uom': False, - 'bom_id': False + 'bom_id': False, + 'routing_id': False }} res = self.pool.get('product.product').browse(cr, uid, product, context=context) result = { 'product_uom': res.uom_id and res.uom_id.id or False, - 'bom_id': res.bom_ids and res.bom_ids[0].id or False + 'bom_id': res.bom_ids and res.bom_ids[0].id or False, + 'routing_id': res.bom_ids and res.bom_ids[0].routing_id.id or False } return {'value': result} diff --git a/addons/mrp_operations/mrp_operations.py b/addons/mrp_operations/mrp_operations.py index 84ae3c304b0..2249e57b556 100644 --- a/addons/mrp_operations/mrp_operations.py +++ b/addons/mrp_operations/mrp_operations.py @@ -64,7 +64,7 @@ class mrp_production_workcenter_line(osv.osv): """ res = {} for op in self.browse(cr, uid, ids, context=context): - res[op.id]= False + res[op.id] = False if op.date_planned: d = DateTime.strptime(op.date_planned,'%Y-%m-%d %H:%M:%S') i = self.pool.get('resource.calendar').interval_get(cr, uid, op.workcenter_id.calendar_id.id or False, d, op.hour or 0.0) @@ -224,8 +224,6 @@ class mrp_production(osv.osv): obj = self.browse(cr, uid, ids)[0] for workcenter_line in obj.workcenter_lines: tmp = self.pool.get('mrp.production.workcenter.line').action_done(cr, uid, [workcenter_line.id]) - 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) def action_in_production(self, cr, uid, ids): @@ -236,8 +234,6 @@ class mrp_production(osv.osv): workcenter_line_obj = self.pool.get('mrp.production.workcenter.line') for workcenter_line in obj.workcenter_lines: workcenter_line_obj.action_start_working(cr, uid, [workcenter_line.id]) - 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) def action_cancel(self, cr, uid, ids): @@ -247,8 +243,6 @@ class mrp_production(osv.osv): obj = self.browse(cr, uid, ids)[0] for workcenter_line in obj.workcenter_lines: tmp = self.pool.get('mrp.production.workcenter.line').action_cancel(cr, uid, [workcenter_line.id]) - 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) def _compute_planned_workcenter(self, cr, uid, ids, context={}, mini=False): From 0f352e33e969aacf69679cacc88e0cbfd6a277f9 Mon Sep 17 00:00:00 2001 From: uco Date: Thu, 15 Jul 2010 17:39:43 +0530 Subject: [PATCH 02/44] [FIX, IMP] stock_planning: Create Periods wizard error. Improved methods. bzr revid: uco@tinyerp.com-20100715120943-tfiymtgi7poe2do3 --- addons/stock_planning/stock_planning.py | 11 +++++++---- addons/stock_planning/stock_planning_view.xml | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/addons/stock_planning/stock_planning.py b/addons/stock_planning/stock_planning.py index bdfcc9991a2..0adae906908 100644 --- a/addons/stock_planning/stock_planning.py +++ b/addons/stock_planning/stock_planning.py @@ -27,7 +27,7 @@ from mx.DateTime import RelativeDateTime, now, DateTime, localtime from osv import osv, fields import netsvc from tools.translate import _ -from tools import config +#from tools import config def rounding(fl, round_value): @@ -63,7 +63,7 @@ class stock_period_createlines(osv.osv_memory): } def create_period_weekly(self, cr, uid, ids, context=None): - res = self.create_period(cr, uid, ids, context, 6, 'Weekly') + res = self.create_period(cr, uid, ids, context=context) return { 'view_type': 'form', "view_mode": 'tree', @@ -71,7 +71,8 @@ class stock_period_createlines(osv.osv_memory): 'type': 'ir.actions.act_window', } - def create_period_monthly(self,cr, uid, ids, interval=1, context=None): + def create_period_monthly(self, cr, uid, ids, context=None): + interval = context.get('interval',1) for p in self.browse(cr, uid, ids, context=context): dt = p.date_start ds = mx.DateTime.strptime(p.date_start, '%Y-%m-%d') @@ -90,7 +91,9 @@ class stock_period_createlines(osv.osv_memory): 'type': 'ir.actions.act_window', } - def create_period(self, cr, uid, ids, interval=0, name='Daily', context=None): + def create_period(self, cr, uid, ids, context=None): + interval = context.get('interval',0) + name = context.get('name','Daily') for p in self.browse(cr, uid, ids, context=context): dt = p.date_start ds = mx.DateTime.strptime(p.date_start, '%Y-%m-%d') diff --git a/addons/stock_planning/stock_planning_view.xml b/addons/stock_planning/stock_planning_view.xml index 0bb9222df35..43de4a67160 100644 --- a/addons/stock_planning/stock_planning_view.xml +++ b/addons/stock_planning/stock_planning_view.xml @@ -19,8 +19,8 @@