-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[FIX] product: apply pricelist formula rounding AFTER currency conversion #102920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX] product: apply pricelist formula rounding AFTER currency conversion #102920
Conversation
@fw-bot up to 15.0 |
Forward-porting to '15.0'. |
55709fa
to
bb91155
Compare
0ac9ef8
to
6f81da6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the ping ;-) I mean, you already know this unambiguously breaks the stability policy... I don't have a test case under hand, but I think the best way to do it anyway would be to:
This way any overriding code can be adapted to the new signature by also overriding the conversion method. Whereas right now it wouldn't be possible without patching the standard. It would still be painful to discover the breaking change inadvertently, but at least there would be a clear path to a fix. |
Hello @len-foss, thanks for the reply, and sorry for the late reply. I'm not sure I understand what you have in mind. Could you elaborate ?
What last line are we talking about ? |
18df1c3
to
b31658c
Compare
71186a7
to
cfd5e22
Compare
…sion The setup: * activate multicurrency and a secondary currency, for example the DKK. Make sure the exchange rate is not 1. * in Settings - Sales - Pricelists, activate Advanced Price Rules * create a new DKK pricelist with the following settings: * Compute Formula * Based on Sales Price * Discount 42% (or any another value) * Rounding Method 1.00 * Apply on All Products * Min Quantity 10 Steps to reproduce: * create a new sales order * set Pricelist = the DKK pricelist you created * add a product and set the quantity to 10 You should see that the total, after application of the pricelist, is not rounded. Cause: The price is being rounded before conversion to the pricelist's currency. Solution: Finetuning of b7ec0a2 to make sure the pricelist base price is consistently rounded before applying the rule formula (surcharge, margins, rounding, ...). Previously, the price given to _compute_price was: * in the pricelist currency if the rule is based on another pricelist * in the product currency if the rule is based on the sales price * in the product cost currency if the rule is based on the cost Now, the price given is always in the pricelist currency. This modifies the API of the method in stable (modifying the currency of the price input), but is quite a logical change and required to fix the issue at hand. Note: The issue is fixed as of v15.2 opw-3002376
cfd5e22
to
0ee7173
Compare
@robodoo r+ |
…sion The setup: * activate multicurrency and a secondary currency, for example the DKK. Make sure the exchange rate is not 1. * in Settings - Sales - Pricelists, activate Advanced Price Rules * create a new DKK pricelist with the following settings: * Compute Formula * Based on Sales Price * Discount 42% (or any another value) * Rounding Method 1.00 * Apply on All Products * Min Quantity 10 Steps to reproduce: * create a new sales order * set Pricelist = the DKK pricelist you created * add a product and set the quantity to 10 You should see that the total, after application of the pricelist, is not rounded. Cause: The price is being rounded before conversion to the pricelist's currency. Solution: Finetuning of b7ec0a2 to make sure the pricelist base price is consistently rounded before applying the rule formula (surcharge, margins, rounding, ...). Previously, the price given to _compute_price was: * in the pricelist currency if the rule is based on another pricelist * in the product currency if the rule is based on the sales price * in the product cost currency if the rule is based on the cost Now, the price given is always in the pricelist currency. This modifies the API of the method in stable (modifying the currency of the price input), but is quite a logical change and required to fix the issue at hand. Note: The issue is fixed as of v15.2 opw-3002376 closes #102920 Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
…sion The setup: * activate multicurrency and a secondary currency, for example the DKK. Make sure the exchange rate is not 1. * in Settings - Sales - Pricelists, activate Advanced Price Rules * create a new DKK pricelist with the following settings: * Compute Formula * Based on Sales Price * Discount 42% (or any another value) * Rounding Method 1.00 * Apply on All Products * Min Quantity 10 Steps to reproduce: * create a new sales order * set Pricelist = the DKK pricelist you created * add a product and set the quantity to 10 You should see that the total, after application of the pricelist, is not rounded. Cause: The price is being rounded before conversion to the pricelist's currency. Solution: Finetuning of b7ec0a2 to make sure the pricelist base price is consistently rounded before applying the rule formula (surcharge, margins, rounding, ...). Previously, the price given to _compute_price was: * in the pricelist currency if the rule is based on another pricelist * in the product currency if the rule is based on the sales price * in the product cost currency if the rule is based on the cost Now, the price given is always in the pricelist currency. This modifies the API of the method in stable (modifying the currency of the price input), but is quite a logical change and required to fix the issue at hand. Note: The issue is fixed as of v15.2 opw-3002376 closes odoo/odoo#102920 Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
…sion The setup: * activate multicurrency and a secondary currency, for example the DKK. Make sure the exchange rate is not 1. * in Settings - Sales - Pricelists, activate Advanced Price Rules * create a new DKK pricelist with the following settings: * Compute Formula * Based on Sales Price * Discount 42% (or any another value) * Rounding Method 1.00 * Apply on All Products * Min Quantity 10 Steps to reproduce: * create a new sales order * set Pricelist = the DKK pricelist you created * add a product and set the quantity to 10 You should see that the total, after application of the pricelist, is not rounded. Cause: The price is being rounded before conversion to the pricelist's currency. Solution: Finetuning of b7ec0a2 to make sure the pricelist base price is consistently rounded before applying the rule formula (surcharge, margins, rounding, ...). Previously, the price given to _compute_price was: * in the pricelist currency if the rule is based on another pricelist * in the product currency if the rule is based on the sales price * in the product cost currency if the rule is based on the cost Now, the price given is always in the pricelist currency. This modifies the API of the method in stable (modifying the currency of the price input), but is quite a logical change and required to fix the issue at hand. Note: The issue is fixed as of v15.2 opw-3002376 closes odoo/odoo#102920 Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
The setup
Steps to reproduce
You should see that the total, after application of the pricelist, is not rounded.
Cause
The price is being rounded before conversion to the pricelist's currency.
Note
The issue is fixed as of v15.2
opw-3002376