[FIX] sale_loyalty: prevent tax splitting on discount line#265606
Closed
fw-bot wants to merge 1 commit into
Closed
[FIX] sale_loyalty: prevent tax splitting on discount line#265606fw-bot wants to merge 1 commit into
fw-bot wants to merge 1 commit into
Conversation
Steps to produce: - Install `website_sale`, `l10n_ca` & `accountant` modules with demo data. - Switch to a Canadian (CA) company. - Go to Settings and enable Discounts, Loyalty & Gift Cards. - Go to Website > eCommerce > Loyalty > Discount & Loyalty. - Create a new program > Set Program Type to Discount Code > Under Conditional Rules, set Minimum Purchase to 0 > Under Rewards, choose Discount on Order. - Go to `website > configuration > websites` > Create a new website for the CA company > Set it as default (first in sequence). - Create new product > Set Sales Taxes to 14.975% GST + QST > Publish the product. - Open the website in an incognito window > Add the product to the cart > Apply the discount code. - In the main tab > Go to Website > eCommerce > Orders > Open the corresponding order > In the Other Info tab, change the fiscal position to Quebec (QC) > Click to update taxes. Issue: - The tax on the discount line is split into: 14.975% GST + QST & 9.975% QST. Root cause: - When a discount is applied in the cart, the discount line initially carries split taxes: 5% GST and 9.975% QST. - After changing the fiscal position to Quebec (QC), the system replaces 5% GST with 14.975% GST + QST because 5% GST is present in replace of 14.975% GST. so at [1] it replaces 5% GST with 14.975% GST and do nothing for 9.975% QST. - In 17.0, the discount line directly uses 14.975% GST + QST (no tax splitting), so this issue does not occur. - In 18.0, at [2], taxes are explicitly split and added to the base line, and the same split taxes are reused during grouping. This leads to multiple taxes being displayed on the sale order line. Fix: - Avoid splitting taxes on the discount line in the sale order. - Keep the original tax structure intact to prevent duplication after fiscal position changes. [1]: https://github.com/odoo/odoo/blob/c6d9fa5873eb759846e9be5b66eedb8b00c5ac11/addons/account/models/partner.py#L151-L156 [2]: https://github.com/odoo/odoo/blob/c6d9fa5873eb759846e9be5b66eedb8b00c5ac11/addons/sale_loyalty/models/sale_order.py#L296 opw-6145674 X-original-commit: bdeade7
Contributor
Contributor
Author
|
This PR targets saas-18.3 and is part of the forward-port chain. Further PRs will be created up to master. More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port |
Contributor
Author
|
@krip-odoo ci/runbot failed on this forward-port PR |
robodoo
pushed a commit
that referenced
this pull request
May 22, 2026
Steps to produce: - Install `website_sale`, `l10n_ca` & `accountant` modules with demo data. - Switch to a Canadian (CA) company. - Go to Settings and enable Discounts, Loyalty & Gift Cards. - Go to Website > eCommerce > Loyalty > Discount & Loyalty. - Create a new program > Set Program Type to Discount Code > Under Conditional Rules, set Minimum Purchase to 0 > Under Rewards, choose Discount on Order. - Go to `website > configuration > websites` > Create a new website for the CA company > Set it as default (first in sequence). - Create new product > Set Sales Taxes to 14.975% GST + QST > Publish the product. - Open the website in an incognito window > Add the product to the cart > Apply the discount code. - In the main tab > Go to Website > eCommerce > Orders > Open the corresponding order > In the Other Info tab, change the fiscal position to Quebec (QC) > Click to update taxes. Issue: - The tax on the discount line is split into: 14.975% GST + QST & 9.975% QST. Root cause: - When a discount is applied in the cart, the discount line initially carries split taxes: 5% GST and 9.975% QST. - After changing the fiscal position to Quebec (QC), the system replaces 5% GST with 14.975% GST + QST because 5% GST is present in replace of 14.975% GST. so at [1] it replaces 5% GST with 14.975% GST and do nothing for 9.975% QST. - In 17.0, the discount line directly uses 14.975% GST + QST (no tax splitting), so this issue does not occur. - In 18.0, at [2], taxes are explicitly split and added to the base line, and the same split taxes are reused during grouping. This leads to multiple taxes being displayed on the sale order line. Fix: - Avoid splitting taxes on the discount line in the sale order. - Keep the original tax structure intact to prevent duplication after fiscal position changes. [1]: https://github.com/odoo/odoo/blob/c6d9fa5873eb759846e9be5b66eedb8b00c5ac11/addons/account/models/partner.py#L151-L156 [2]: https://github.com/odoo/odoo/blob/c6d9fa5873eb759846e9be5b66eedb8b00c5ac11/addons/sale_loyalty/models/sale_order.py#L296 opw-6145674 closes #265606 X-original-commit: bdeade7 Signed-off-by: Krishna Arvindkumar Patel (krip) <krip@odoo.com>
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.

Steps to produce:
website_sale,l10n_ca&accountantmodules with demo data.Canadian (CA) company.Discounts, Loyalty & Gift Cards.Website > eCommerce > Loyalty > Discount & Loyalty.website > configuration > websites> Create a new website for the CA company > Set it as default (first in sequence).14.975% GST + QST> Publish the product.Issue:
Root cause:
Fix:
[1]
odoo/addons/account/models/partner.py
Lines 151 to 156 in c6d9fa5
[2]
odoo/addons/sale_loyalty/models/sale_order.py
Line 296 in c6d9fa5
opw-6145674
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Forward-Port-Of: #265233
Forward-Port-Of: #262147