Openbravo Issue Tracking System - Retail Modules
View Issue Details
0048619Retail ModulesTax Exemptpublic2022-02-17 14:282022-03-16 14:51
jetxarri 
ranjith_qualiantech_com 
highmajoralways
closedfixed 
5
 
RR20Q4RR22Q2 
No
0048619: Wrong tax assigned when you are using tax exempt ticket line and you have some taxes with same configuration
Wrong tax assigned when you are using tax exempt ticket line (or BP) and you have some taxes with same configuration.
Scenario:
-2 taxes defined exactly equal and the only difference is the business partner tax category and valid from date
-inside web POS, select a bp with tax exempt
-Add a product with tax category of the defined tax rates

Verify that the applied tax is the one with more recent valifFromDate. So change not applied tax with a newer validFromDate and do the same steps. Now the other tax is applied
In the following function

const checkTaxCategory = rule => {
      const isTaxExempt =
        line.taxExempt || ticket.businessPartner.taxExempt ;
      return (
        (isTaxExempt
          ? equals(rule.taxExempt, isTaxExempt)
          : equals(
              rule.businessPartnerTaxCategory,
              ticket.businessPartner.taxCategory
            )) && equals(rule.taxCategory, line.product.taxCategory)
      );
    };

When we check if "isTaxExempt" to get the rule (tax rate) we are only taking into account the checkbox "taxExempt" when we should check "taxExempt" check + the business partner tax category.

return (
        (isTaxExempt
          ? equals(rule.taxExempt, isTaxExempt) && equals(
              rule.businessPartnerTaxCategory,
              ticket.businessPartner.taxCategory
            )
          : equals(
              rule.businessPartnerTaxCategory,
              ticket.businessPartner.taxCategory
            )) && equals(rule.taxCategory, line.product.taxCategory)
      );
NOR
related to defect 0049939 closed Triage Omni OMS Openbravo Localizations Two exempt taxes are applied for a tax exempt customer 
Issue History
2022-02-17 14:28jetxarriNew Issue
2022-02-17 14:28jetxarriAssigned To => Retail
2022-02-17 14:28jetxarriTriggers an Emergency Pack => No
2022-02-17 14:41rafarodaTag Attached: NOR
2022-02-17 14:41rafarodaIssue Monitored: rafaroda
2022-02-18 11:25ranjith_qualiantech_comAssigned ToRetail => ranjith_qualiantech_com
2022-02-18 11:37ranjith_qualiantech_comStatusnew => scheduled
2022-03-02 08:07hgbotNote Added: 0135375
2022-03-16 14:49hgbotNote Added: 0135777
2022-03-16 14:49hgbotResolutionopen => fixed
2022-03-16 14:49hgbotStatusscheduled => closed
2022-03-16 14:49hgbotFixed in Version => RR22Q2
2022-03-16 14:49hgbotNote Added: 0135778
2022-03-16 14:51hgbotNote Added: 0135779
2022-08-03 13:52rafarodaRelationship addedrelated to 0049939

Notes
(0135375)
hgbot   
2022-03-02 08:07   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/merge_requests/730 [^]
(0135777)
hgbot   
2022-03-16 14:49   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/merge_requests/730 [^]
(0135778)
hgbot   
2022-03-16 14:49   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal [^]
Changeset: 8b7a8ee4aff216ae4f27c2fb5bcabf5ef3ba364b
Author: Ranjith S R <ranjith@qualiantech.com>
Date: 16-03-2022 13:49:11
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/commit/8b7a8ee4aff216ae4f27c2fb5bcabf5ef3ba364b [^]

Fixed ISSUE-48619: Added BP TaxCategory validation for Tax Exempt

- Rules must be filtered by business partner tax category always, regardless the ticket is exempt or not.
- Rules must be filtered by tax exempt only in case ticket is exempt, because exempt rules can apply to non exempt business partners depending on the origin and destination of the goods, but non exempt rules can never apply to exempt business partners.

---
M web/org.openbravo.retail.posterminal/app/model/business-logic/taxes-engine/engine/tax-engine.js
---
(0135779)
hgbot   
2022-03-16 14:51   
Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.taxes [^]
Changeset: 6973c2f63a9bb9f0ce5c226518e6ea42c2c9cbd1
Author: Ranjith S R <ranjith@qualiantech.com>
Date: 16-03-2022 13:51:15
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.taxes/-/commit/6973c2f63a9bb9f0ce5c226518e6ea42c2c9cbd1 [^]

Related to ISSUE-48619: Added Test for BPTaxCategory validations

---
A src-test/org/openbravo/taxes/test/data/TaxesTestData56.java
M src-test/org/openbravo/taxes/test/base/Tax.java
M src-test/org/openbravo/taxes/test/base/model/BusinessPartner.java
M src-test/org/openbravo/taxes/test/base/model/BusinessPartnerTaxCategory.java
M src-test/org/openbravo/taxes/test/base/model/TaxesRule.java
M src-test/org/openbravo/taxes/test/base/model/TaxesRulesScenario.java
M src-test/org/openbravo/taxes/test/unittests/TaxesTest.java
M src-test/org/openbravo/taxes/test/util/TaxesTestConstants.java
---