[FIX] product_visible_discount: use on_change result for product value
authorMartin Trigaux <mat@odoo.com>
Mon, 27 Oct 2014 12:45:53 +0000 (13:45 +0100)
committerMartin Trigaux <mat@odoo.com>
Mon, 27 Oct 2014 12:59:41 +0000 (13:59 +0100)
At the end of the onchange call product_id_change, the uom may have changed (e.g. if product in different category).
To compute the quantity, we need to use the new uom and not the first one (that may be Unit, default value)

addons/product_visible_discount/product_visible_discount.py

index f173e84..138c141 100644 (file)
@@ -79,7 +79,7 @@ class sale_order_line(osv.osv):
                 price=result['price_unit']
             else:
                 return res
-
+            uom = result.get('product_uom', uom)
             product = product_obj.browse(cr, uid, product, context)
             list_price = pricelist_obj.price_get(cr, uid, [pricelist],
                     product.id, qty or 1.0, partner_id, {'uom': uom,'date': date_order })