odoo/odoo#265606
Created by fw-bot
Merged
at de23c88b97782513d773fc25e5f9e1d8388b01d8
Statuses:
- legal/cla: Contributor License Agreement check
- ci/runbot: Odoo Test Suite
- ci/upgrade_enterprise: Test upgrades for enterprise master
- ci/template: (runtime 2135s)
- ci/style: Optional style check. Ignore it only if strictly necessary.
- ci/security: Required security check. Can only be ignored by security team.
- ci/l10n: (runtime 25s)
- ci/documentation: (runtime 1104s)
- ci/design-theme: (runtime 3312s)
- label
- odoo-dev:saas-18.3-18.0-opw-6145674-wrong-tax-behaviour-krip-527859-fw
- head
- 0a674740c4d0ed518f3a24e691e5de174720a4dc
- merged
- 1 week ago by Krishna Arvindkumar Patel (krip)
| odoo/odoo | |
|---|---|
| 18.0 | #262147 |
| saas-18.2 | #265233 |
| saas-18.3 | #265606 |
| saas-18.4 | #265705 |
| 19.0 | #265737 |
| saas-19.1 | #265808 |
| saas-19.2 | #265870 |
| saas-19.3 | #265962 |
| master | #266068 |
[FIX] sale_loyalty: prevent tax splitting on discount line
Steps to produce:
- Install
website_sale,l10n_ca&accountantmodules 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
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr