From 28a17a63fe530053cef3a812ff3c2b77a37fc6a3 Mon Sep 17 00:00:00 2001 From: Paramjit Singh Sahota Date: Fri, 30 Nov 2012 16:54:34 +0530 Subject: [PATCH] [IMP] Added code for the onchange Product to Produce: Product field + Quantity field + Unit of Measure field should be filled automatically via onchange if you created/selected a Manufacturing Order before saving bzr revid: psa@tinyerp.com-20121130112434-ajfuq8h0f5u21qyy --- addons/mrp_operations/mrp_operations.py | 13 +++++++++++++ addons/mrp_operations/mrp_operations_view.xml | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/addons/mrp_operations/mrp_operations.py b/addons/mrp_operations/mrp_operations.py index 3f71777a66f..1facec60a50 100644 --- a/addons/mrp_operations/mrp_operations.py +++ b/addons/mrp_operations/mrp_operations.py @@ -83,6 +83,19 @@ class mrp_production_workcenter_line(osv.osv): res = date_planned return {'value':{'date_planned_end': res}} + def onchange_production_id(self, cr, uid, ids, production_id, context=None): + """ Finds UoM of changed product. + @param product_id: Id of changed product. + @return: Dictionary of values. + """ + products = self.pool.get('mrp.production').browse(cr, uid, production_id, context=None) + result = { + 'product': products.product_id.id, + 'qty': products.product_qty, + 'uom': products.product_uom.id, + } + return {'value': result} + _inherit = 'mrp.production.workcenter.line' _order = "sequence, date_planned" diff --git a/addons/mrp_operations/mrp_operations_view.xml b/addons/mrp_operations/mrp_operations_view.xml index ecd04f13292..d7752939b75 100644 --- a/addons/mrp_operations/mrp_operations_view.xml +++ b/addons/mrp_operations/mrp_operations_view.xml @@ -76,7 +76,7 @@ - +