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

Proposed by Yann Papouin
Status: Merged
Merged at revision: 10011
Proposed branch: lp:~yann-papouin/ocb-addons/7.0-bug-1188629-price-surchage-uom
Merge into: lp:ocb-addons
Diff against target: 21 lines (+6/-1)
1 file modified
product/pricelist.py (+6/-1)
To merge this branch: bzr merge lp:~yann-papouin/ocb-addons/7.0-bug-1188629-price-surchage-uom
Reviewer Review Type Date Requested Status
Sandy Carter (http://www.savoirfairelinux.com) code review, pep8 Approve
Yannick Vaucher @ Camptocamp code review, no test Approve
Holger Brunn (Therp) code review Approve
Review via email: mp+210159@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote :

same as 6.1-ocb

review: Approve (code review)
Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

forward port of bug fix in 6.1

Thanks

review: Approve (code review, no test)
Revision history for this message
Sandy Carter (http://www.savoirfairelinux.com) (sandy-carter) :
review: Approve (code review, pep8)

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 09:41:56 +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']: