← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~yann-papouin/ocb-addons/7.0-bug-1188629-price-surchage-uom into lp:ocb-addons

 

Yann Papouin has proposed merging lp:~yann-papouin/ocb-addons/7.0-bug-1188629-price-surchage-uom into lp:ocb-addons.

Requested reviews:
  OpenERP Community Backports Team (ocb)
Related bugs:
  Bug #1188629 in OpenERP Community Backports (Addons): "[6.1][7.0][trunk] price_surcharge must be affiliated with product uom"
  https://bugs.launchpad.net/ocb-addons/+bug/1188629

For more details, see:
https://code.launchpad.net/~yann-papouin/ocb-addons/7.0-bug-1188629-price-surchage-uom/+merge/210159

Automatically derived from https://code.launchpad.net/~yann-papouin/openobject-addons/7.0-bug-1188629-price-surchage-uom for https://code.launchpad.net/~openerp/openobject-addons/7.0.
-- 
https://code.launchpad.net/~yann-papouin/ocb-addons/7.0-bug-1188629-price-surchage-uom/+merge/210159
Your team OpenERP Community Backports Team is requested to review the proposed merge of lp:~yann-papouin/ocb-addons/7.0-bug-1188629-price-surchage-uom into lp:ocb-addons.
=== modified file 'product/pricelist.py'
--- product/pricelist.py	2014-03-06 19:09:06 +0000
+++ product/pricelist.py	2014-03-10 09:41:56 +0000
@@ -293,11 +293,16 @@
                                     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']:


Follow ups