openerp-india team mailing list archive
-
openerp-india team
-
Mailing list archive
-
Message #25235
[Bug 1188629] Re: [6.1][7.0][trunk] price_surcharge must be affiliated with product uom
** Branch linked: lp:~yann-papouin/openobject-addons/6.1-bug-1188629
-price-surchage-uom
--
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1188629
Title:
[6.1][7.0][trunk] price_surcharge must be affiliated with product uom
Status in OpenERP Addons (modules):
Confirmed
Bug description:
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.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))
price = rounding(price, res['price_round']) #TOFIX: rounding with tools.float_rouding
price += surcharge
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
To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1188629/+subscriptions