[18.0][FIX] purchase_order_secondary_unit: avoid price recomputation from rounded secondary price#3113
Open
sergio-teruel wants to merge 1 commit into
Conversation
…ounded secondary price
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.
Before this PR
When a purchase line uses a secondary unit with a factor that produces a rounded secondary price, the inverse of secondary_uom_price can recompute price_unit from the rounded value.
Example: supplier price 19.95 and secondary factor 0.9 gives 17.955, displayed/stored as 17.96. The inverse then computes 17.96 / 0.9 = 19.955555..., changing the original supplier price.
After this PR
Skip the inverse recomputation when secondary_uom_price matches the expected value from price_unit * factor within the Product Price decimal precision.
This preserves the supplier price while still allowing manual edits of the secondary unit price to update the base price.
cc @Tecnativa TT63349
ping @carlosdauden @CarlosRoca13 @juancarlosonate-tecnativa @sysadminmatmoz