From a10da2aba86409ad8570245731f06e0128d777b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= Date: Thu, 18 Sep 2014 07:14:00 -0300 Subject: [PATCH] [FIX] mrp_repair: pass context in product_id_change calls --- addons/mrp_repair/mrp_repair.py | 10 ++++++---- addons/mrp_repair/mrp_repair_view.xml | 8 ++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py index 2015b11d7c2..d8c8925b24f 100644 --- a/addons/mrp_repair/mrp_repair.py +++ b/addons/mrp_repair/mrp_repair.py @@ -495,7 +495,7 @@ class mrp_repair(osv.osv): class ProductChangeMixin(object): def product_id_change(self, cr, uid, ids, pricelist, product, uom=False, - product_uom_qty=0, partner_id=False, guarantee_limit=False): + product_uom_qty=0, partner_id=False, guarantee_limit=False, context=None): """ On change of product it sets product quantity, tax account, name, uom of product, unit price and price subtotal. @param pricelist: Pricelist of current record. @@ -508,16 +508,18 @@ class ProductChangeMixin(object): """ result = {} warning = {} + ctx = context and context.copy() or {} + ctx['uom'] = uom if not product_uom_qty: product_uom_qty = 1 result['product_uom_qty'] = product_uom_qty if product: - product_obj = self.pool.get('product.product').browse(cr, uid, product) + product_obj = self.pool.get('product.product').browse(cr, uid, product, context=ctx) if partner_id: partner = self.pool.get('res.partner').browse(cr, uid, partner_id) - result['tax_id'] = self.pool.get('account.fiscal.position').map_tax(cr, uid, partner.property_account_position, product_obj.taxes_id) + result['tax_id'] = self.pool.get('account.fiscal.position').map_tax(cr, uid, partner.property_account_position, product_obj.taxes_id, context=ctx) result['name'] = product_obj.display_name result['product_uom'] = product_obj.uom_id and product_obj.uom_id.id or False @@ -530,7 +532,7 @@ class ProductChangeMixin(object): } else: price = self.pool.get('product.pricelist').price_get(cr, uid, [pricelist], - product, product_uom_qty, partner_id, {'uom': uom})[pricelist] + product, product_uom_qty, partner_id, context=ctx)[pricelist] if price is False: warning = { diff --git a/addons/mrp_repair/mrp_repair_view.xml b/addons/mrp_repair/mrp_repair_view.xml index e11acdb6b56..2f160cf1aef 100644 --- a/addons/mrp_repair/mrp_repair_view.xml +++ b/addons/mrp_repair/mrp_repair_view.xml @@ -68,7 +68,7 @@ - +