[13.0][14.0] Wrong price on SO when using UOM with ratio
Closed this issue · 4 comments
Module
product_variant_sale_price
Describe the bug
Price is not correct on SO on a product configured with a different UOM than the base UOM and we change the UOM to an other UOM of same type on SO
To Reproduce
Affected versions: 13.0, 14.0 (not tested on other versions)
Steps to reproduce the behavior:
-
Install modules: sale, product_variant_sale_price
-
Create a new UOM "box of 2000 units" with :
- Category: "Unit"
- Type: "Bigger than the reference Unit of Measure"
- Bigger Ratio: "2000"
-
Create a product with :
- Sales price: 2000000
- Unit of measure: Box of 2000
Price is correct
6. Change UOM to "Unit"
Price is wrong
Expected behavior
Price should have been "2000000 euro / 2000 (ratio)"=1000 like on standard Odoo
Additional context
Error seems to be in functions "_compute_lst_price", "_compute_list_price", "_inverse_product_lst_price" on product.product
If you open the product from the sale orrder line with "unit" UOM, you'll see "Public price" already computer with the UOM set on sale order line
Same with V15 :(
hi,
I met the same problem recently (in odoo V14) and i changed the _compute_list_price like this :
def _compute_list_price(self):
uom_model = self.env["uom.uom"]
for product in self:
price = product.fix_price or product.product_tmpl_id.list_price
if self.env.context.get('uom'):
# i check with get because sometimes the key 'uom' is in context
# but the value is False
context_uom = uom_model.browse(self.env.context.get('uom'))
price = context_uom._compute_price(
price, context_uom)
product.list_price = price
For the moment it is working for me ^^
same here in v14
There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.