Skip to content

Commit 23a8749

Browse files
author
Juan Ignacio Carreras
committed
[FIX] product_replenishment_cost: skip currency convert when same currency in compute
_compute_price_unit_and_date_planned_and_name was calling _convert() unconditionally, which applies currency rounding even for same-currency pairs. For supplier prices below currency precision (e.g. 0.0046 USD rounded to 2 decimals = 0.00), this caused price_unit to compute as 0 on manually added PO lines. _prepare_purchase_order_line already guards with if supplier.currency_id != po.currency_id Apply the same guard in the compute method.
1 parent e93c66b commit 23a8749

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

product_replenishment_cost/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Replenishment Cost",
3-
"version": "18.0.1.1.0",
3+
"version": "18.0.1.2.0",
44
"author": "ADHOC SA, Odoo Community Association (OCA)",
55
"license": "AGPL-3",
66
"category": "Products",

product_replenishment_cost/models/purchase_order_line.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ def _compute_price_unit_and_date_planned_and_name(self):
3333
if seller
3434
else 0.0
3535
)
36-
price_unit = seller.currency_id._convert(
37-
price_unit, line.currency_id, line.company_id, line.date_order or fields.Date.today()
38-
)
36+
if seller.currency_id and line.currency_id and seller.currency_id != line.currency_id:
37+
price_unit = seller.currency_id._convert(
38+
price_unit, line.currency_id, line.company_id, line.date_order or fields.Date.today()
39+
)
3940

4041
if seller and line.product_uom and seller.product_uom != line.product_uom:
4142
price_unit = seller.product_uom._compute_price(price_unit, line.product_uom)

0 commit comments

Comments
 (0)