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

Proposed by Yann Papouin
Status: Needs review
Proposed branch: lp:~yann-papouin/openobject-addons/7.0-bug-1188629-price-surchage-uom
Merge into: lp:openobject-addons/7.0
Diff against target: 21 lines (+6/-1)
1 file modified
product/pricelist.py (+6/-1)
To merge this branch: bzr merge lp:~yann-papouin/openobject-addons/7.0-bug-1188629-price-surchage-uom
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+210146@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

9885. By Yann Papouin

price_surcharge must be affiliated with product uom

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'product/pricelist.py'
2--- product/pricelist.py 2014-03-06 19:09:06 +0000
3+++ product/pricelist.py 2014-03-10 08:58:17 +0000
4@@ -293,11 +293,16 @@
5 price_type.field, context=context)[product_id], round=False, context=context)
6
7 if price is not False:
8+ surcharge = res['price_surcharge'] or 0.0
9+ if surcharge and 'uom' in context:
10+ product = products_dict[product_id]
11+ uom = product.uos_id or product.uom_id
12+ surcharge = product_uom_obj._compute_price(cr, uid, uom.id, surcharge, context['uom'])
13 price_limit = price
14 price = price * (1.0+(res['price_discount'] or 0.0))
15 if res['price_round']:
16 price = tools.float_round(price, precision_rounding=res['price_round'])
17- price += (res['price_surcharge'] or 0.0)
18+ price += surcharge
19 if res['price_min_margin']:
20 price = max(price, price_limit+res['price_min_margin'])
21 if res['price_max_margin']: