diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 4aa59744a12..957253bbf7c 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -908,8 +908,11 @@ class purchase_order_line(osv.osv): """ onchange handler of product_uom. """ + if context is None: + context = {} if not uom_id: return {'value': {'price_unit': price_unit or 0.0, 'name': name or '', 'product_uom' : uom_id or False}} + context = dict(context, purchase_uom_check=True) return self.onchange_product_id(cr, uid, ids, pricelist_id, product_id, qty, uom_id, partner_id, date_order=date_order, fiscal_position_id=fiscal_position_id, date_planned=date_planned, name=name, price_unit=price_unit, context=context) @@ -983,7 +986,7 @@ class purchase_order_line(osv.osv): uom_id = product_uom_po_id if product.uom_id.category_id.id != product_uom.browse(cr, uid, uom_id, context=context).category_id.id: - if self._check_product_uom_group(cr, uid, context=context): + if context.get('purchase_uom_check') and self._check_product_uom_group(cr, uid, context=context): res['warning'] = {'title': _('Warning!'), 'message': _('Selected Unit of Measure does not belong to the same category as the product Unit of Measure.')} uom_id = product_uom_po_id