The price_surcharge is not linked to product uom. It's a mistake or a design choice ?
eg: ProductA with an UOM = PCE with a price of 10.0
If in the pricelist, you defines a surcharge of 2.0
When the price is computed you will have:
ProductA with Quantity 1.0 x PCE = 10.0 + 2.0 = 12.0
ProductA with Quantity 1.0 x 10PCE = 100.0 + 2.0 = 102.0
ProductA with Quantity 1.0 x 50PCE = 500.0 + 2.0 = 502.0
That's not correct, you should have:
ProductA with Quantity 1.0 x PCE = 10.0 + 2.0 = 12.0
ProductA with Quantity 1.0 x 10PCE = 100.0 + 20.0 = 120.0
ProductA with Quantity 1.0 x 50PCE = 500.0 + 100.0 = 600.0
Fix proposal:
=========================
in addons/product/pricelist.py
REPLACE:
-----------------------------------
if price is not False:
price_limit = price
price = price * (1.0+(res['price_discount'] or 0.0))
price = rounding(price, res['price_round']) #TOFIX: rounding with tools.float_rouding
price += (res['price_surcharge'] or 0.0)
if res['price_min_margin']:
price = max(price, price_limit+res['price_min_margin'])
if res['price_max_margin']:
price = min(price, price_limit+res['price_max_margin'])
break
WITH:
-----------------------------------
if price is not False:
surcharge = res['price_surcharge'] or 0.0)
if 'uom' in context:
product = products_dict[product_id]
uom = product.uom_po_id or product.uos_id
surcharge = product_uom_obj._compute_price(cr, uid, uom.id, surcharge, context['uom'])
The price_surcharge is not linked to product uom. It's a mistake or a design choice ?
eg: ProductA with an UOM = PCE with a price of 10.0
If in the pricelist, you defines a surcharge of 2.0
When the price is computed you will have:
ProductA with Quantity 1.0 x PCE = 10.0 + 2.0 = 12.0
ProductA with Quantity 1.0 x 10PCE = 100.0 + 2.0 = 102.0
ProductA with Quantity 1.0 x 50PCE = 500.0 + 2.0 = 502.0
That's not correct, you should have:
ProductA with Quantity 1.0 x PCE = 10.0 + 2.0 = 12.0
ProductA with Quantity 1.0 x 10PCE = 100.0 + 20.0 = 120.0
ProductA with Quantity 1.0 x 50PCE = 500.0 + 100.0 = 600.0
Fix proposal: ======= ======= ==== product/ pricelist. py
=======
in addons/
REPLACE: ------- ------- ------- ------- 'price_ discount' ] or 0.0)) surcharge' ] or 0.0) min_margin' ]: res['price_ min_margin' ]) max_margin' ]: res['price_ max_margin' ])
-------
if price is not False:
price_limit = price
price = price * (1.0+(res[
price = rounding(price, res['price_round']) #TOFIX: rounding with tools.float_rouding
price += (res['price_
if res['price_
price = max(price, price_limit+
if res['price_
price = min(price, price_limit+
break
WITH: ------- ------- ------- ------- surcharge' ] or 0.0) dict[product_ id] uom_obj. _compute_ price(cr, uid, uom.id, surcharge, context['uom'])
-------
if price is not False:
surcharge = res['price_
if 'uom' in context:
product = products_
uom = product.uom_po_id or product.uos_id
surcharge = product_
price_limit = price 'price_ discount' ] or 0.0))
price = price * (1.0+(res[
price = rounding(price, res['price_round']) #TOFIX: rounding with tools.float_rouding
price += surcharge
if res['price_ min_margin' ]: res['price_ min_margin' ]) max_margin' ]: res['price_ max_margin' ])
price = max(price, price_limit+
if res['price_
price = min(price, price_limit+
break