[FIX] product_replenishment_cost: skip currency convert when same currency in compute#905
Open
jcadhoc wants to merge 1 commit into
Open
[FIX] product_replenishment_cost: skip currency convert when same currency in compute#905jcadhoc wants to merge 1 commit into
jcadhoc wants to merge 1 commit into
Conversation
…rency 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.
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
_compute_price_unit_and_date_planned_and_namecallsseller.currency_id._convert()unconditionally. When the seller currency and the line currency are the same (e.g. both USD),_convertstill applies the currency's rounding precision. For very small prices below that precision (e.g.0.0046 USDrounded to 2 decimals →0.00), the computedprice_unitbecomes 0 on manually added PO lines.This does not affect replenishment (
_prepare_purchase_order_line), which already has the guard:Fix
Apply the same guard in
_compute_price_unit_and_date_planned_and_name: only call_convertwhen the currencies differ.Related PRs
Works together with:
standard_pricefallbacks inproduct_replenishment_cost_stockstandard_pricefallback inpurchase_ux