diff --git a/addons/sale/sale.py b/addons/sale/sale.py index d172c7bdb2c..119bee779aa 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -1232,6 +1232,18 @@ class sale_order_line(osv.osv): partner_id=partner_id, lang=lang, update_tax=update_tax, date_order=date_order, context=context) + def onchange_product_uom(self, cursor, user, ids, pricelist, product, qty=0, + uom=False, qty_uos=0, uos=False, name='', partner_id=False, + lang=False, update_tax=True, date_order=False, fiscal_position=False, context=None): + context = context or {} + lang = lang or ('lang' in context and context['lang']) + if not uom: + return {'value': {'price_unit': 0.0, 'product_uom' : uom or False}} + return self.product_id_change(cursor, user, ids, pricelist, product, + qty=qty, uom=uom, qty_uos=qty_uos, uos=uos, name=name, + partner_id=partner_id, lang=lang, update_tax=update_tax, + date_order=date_order, fiscal_position=fiscal_position, context=context) + def unlink(self, cr, uid, ids, context=None): if context is None: context = {} diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index be3ad08b6ee..675a621071f 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -134,7 +134,7 @@ on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, False, False, parent.date_order, False, parent.fiscal_position, True, context)"/> + on_change="onchange_product_uom(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, False, False, parent.date_order, parent.fiscal_position, context)"/>