[MRG] product: use product UOM when computing price surcharge
[odoo/odoo.git] / addons / product / pricelist.py
index d4ed256..f695c64 100644 (file)
@@ -293,11 +293,16 @@ class product_pricelist(osv.osv):
                                     price_type.field, context=context)[product_id], round=False, context=context)
 
                         if price is not False:
+                            surcharge = res['price_surcharge'] or 0.0 
+                            if surcharge and 'uom' in context: 
+                                product = products_dict[product_id]
+                                uom = product.uos_id or product.uom_id
+                                surcharge = product_uom_obj._compute_price(cr, uid, uom.id, surcharge, context['uom'])
                             price_limit = price
                             price = price * (1.0+(res['price_discount'] or 0.0))
                             if res['price_round']:
                                 price = tools.float_round(price, precision_rounding=res['price_round'])
-                            price += (res['price_surcharge'] or 0.0)
+                            price += surcharge
                             if res['price_min_margin']:
                                 price = max(price, price_limit+res['price_min_margin'])
                             if res['price_max_margin']: