[FIX] product_replenishment_cost_stock: remove standard_price fallback - #904
Open
jcadhoc wants to merge 1 commit into
Open
[FIX] product_replenishment_cost_stock: remove standard_price fallback#904jcadhoc wants to merge 1 commit into
jcadhoc wants to merge 1 commit into
Conversation
When price_unit resolved to 0 (e.g. net_price not available for the supplier), the fallback to standard_price was producing incorrect prices because the replenishment-cost cron overwrites standard_price with the replenishment cost (often in a different currency/value than the supplier price). Backport of ingadhoc#892 to 18.0 — remove the fallback in both _prepare_purchase_order_line_from_procurement and _update_purchase_order_line so that a zero price stays zero and the caller handles the missing price explicitly.
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
When
price_unitresolved to 0 during procurement/replenishment flows,product_replenishment_cost_stockwas falling back toproduct_id.standard_price. Withproduct_replenishment_costinstalled, the replenishment-cost cron overwritesstandard_pricewith the replenishment cost (often expressed in a different currency, e.g. ARS), producing wrong prices in purchase orders instead of 0 or the correct supplier net price.Affected methods:
_prepare_purchase_order_line_from_procurementinproduct_replenishment_cost_stock/purchase_order_line.py_update_purchase_order_lineinproduct_replenishment_cost_stock/stock_rule.pyFix
Remove both
standard_pricefallbacks. Whennet_priceis 0 or unavailable, the price stays 0 and the caller handles it explicitly — no silent corruption from the replenishment cost value.Notes