Openbravo Issue Tracking System - Retail Modules
View Issue Details
0046314Retail ModulesWeb POSpublic2021-04-21 12:592024-01-23 17:36
psanjuan 
jetxarri 
urgentmajoralways
closedfixed 
30Openbravo Appliance 14.04
 
RR23Q2 
No
0046314: Net Prices must be used if a sale is created for an exempt BP for products having a price list including taxes.
Net Prices must be used if a sale is created for an exempt BP for products having a price list including taxes.
Same would apply for those scenarios when the customer is not exempt, but the transaction itself it is exempt (ie. Intracommunity Sale).
When a customer is “tax exempt” meaning all the taxes goes to 0%, the tax is well calculated but the price remains the same as with normal taxes.
For example :
If a product as 20% tax and its final price is 120€ :

If the customer is a regular customer :
the gross price of the product will be 120€ which is correct
The net price of the product will be 100€ which is correct
The amount of the tax will be 20€ which is correct

If the customer is “tax exempt” :
The gross price will be 120€ instead of 100€
The net price will be 120€ instead of 100€
The amount of the tax will be 0€ which is correct
See Specs attached.
NOR
related to feature request 0054438 new aferraz POS2 Refactor price recalculation when there is a tax exempt 
has duplicate feature request 0046598 closed Retail Retail Modules Web POS needs to manage "Price List including taxes" under "tax exempt" scenarios. 
related to feature request 0045755 closed vmromanos Openbravo Localizations New taxes required set as Tax Exempt=Yes 
related to defect 0045643 closed ranjith_qualiantech_com Retail Modules Tax exempt usage is not applying in Tax Engine 
related to feature request 0054073 closed frank_gonzalez POS2 Country Compliance - Tax Rate Modification "Special Taxes" management in POS2 (React) 
Issue History
2021-04-21 12:59psanjuanNew Issue
2021-04-21 12:59psanjuanAssigned To => Retail
2021-04-21 12:59psanjuanTriggers an Emergency Pack => No
2021-04-21 12:59psanjuanRelationship addedrelated to 0045755
2021-04-21 17:24rafarodaRelationship addedrelated to 0045643
2021-04-21 17:24rafarodaTag Attached: NOR
2021-04-21 17:24rafarodaIssue Monitored: rafaroda
2021-05-10 12:14psanjuanRelationship addedhas duplicate 0046598
2021-05-10 12:17psanjuanSummaryPrices (Gross/Net) must be recalculated if a sale is created for an exempt BP for products having a price list including taxes. => Net Prices must be used if a sale is created for an exempt BP for products having a price list including taxes.
2021-05-10 12:17psanjuanDescription Updatedbug_revision_view_page.php?rev_id=22480#r22480
2021-05-10 12:17psanjuanSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=22482#r22482
2021-05-10 12:17psanjuanProposed Solution updated
2021-05-10 12:18psanjuanNote Added: 0127938
2021-05-10 13:36psanjuanNote Added: 0127941
2021-05-10 13:36psanjuanAssigned ToRetail => psanjuan
2021-05-31 12:58psanjuanNote Added: 0128812
2021-05-31 12:59psanjuanNote Edited: 0128812bug_revision_view_page.php?bugnote_id=0128812#r22637
2022-09-28 14:23hgbotNote Added: 0141445
2022-10-18 11:32aferrazAssigned Topsanjuan => jetxarri
2023-01-04 08:46hgbotNote Added: 0145155
2023-01-25 13:13hgbotNote Added: 0145833
2023-01-30 08:18hgbotResolutionopen => fixed
2023-01-30 08:18hgbotStatusnew => closed
2023-01-30 08:18hgbotNote Added: 0145988
2023-01-30 08:18hgbotFixed in Version => RR23Q2
2023-01-30 08:18hgbotNote Added: 0145989
2023-01-30 08:19hgbotNote Added: 0145990
2023-01-30 08:19hgbotNote Added: 0145991
2023-01-30 08:20hgbotNote Added: 0145992
2023-01-30 08:20hgbotNote Added: 0145993
2024-01-23 17:36aferrazRelationship addedrelated to 0054438
2024-01-23 17:36aferrazRelationship addedrelated to 0054073

Notes
(0127938)
psanjuan   
2021-05-10 12:18   
See Specs:


https://docs.google.com/document/d/1z9VZdMaX11wHhI74o83obQfgjoqWgmop5eds9lq5-RY/edit?ts=60895ae8 [^]
(0127941)
psanjuan   
2021-05-10 13:36   
This new function will be implemented by the services team, and later on contributed to the product.
(0128812)
psanjuan   
2021-05-31 12:58   
(edited on: 2021-05-31 12:59)
The Spec attached is not valid anymore as that is not the correct way to implement this feature.

Correct approach will be:

(1) If a sales line has got an "exempt" tax rate from the OB tax engine, and the price of that product is "including" taxes, what we can do is:
(1.1) create a simplified version of that sales order, containing that product, a Not Exempt BP (Anonymous customer) and the "store" address, therefore we can be sure that this new transaction is NOT exempt
(1.2) By doing so, we will be able to get the "tax rate" that would have applied to a Not Exempt sale, for us to calculate the net price of the product
(1.3) That net price will be persisted in the "original" sales line, therefore the net price and gross price will be the same one, as the "original" tax to apply is exempt.
(2) Obviously the creation of that simplified version of the sales order, will be fully transparent to the user
(3) In case the product is "Exempt" by definition (assigned to an Exempt Tax Category), we can assume that the gross price of the product will be without taxes in the price list, therefore regardless we will get an exempt tax rate in that simplified version of the sales order, the gross price and net price will be the same.

All of the above works if we assume that there is no EcoTax configured, otherwise we will have to adjust the tax engine to take into account the EcoTax configuration of a product.

In such cases, and if the customer provides the final gross price including both EcoTax and VAT, we will have to:

    do the same as above, but in the step 1.2, subtract the EcoTax of that product from its gross price, before calculating the net price.
    Once the Net Price is calculated and persisted in the sales line, we will have to add once again the EcoTax amount to the gross price.

What I mean is:

For instance we do have a product with a Product Price List (including taxes) = 122.00 (100.00 net price + 20.00 VAT + 2.00 EcoTax).
As this product has an EcoTax we will have to subtract it from the product (120.00) and then, calculate the price net of VAT (120/1+20%)=100.00
For an exempt customer, the correct price (price net of VAT) will be 102 (net price+EcoTax).

In fact, current Eco Tax feature is not working properly because VAT tax base calculation is including Eco Tax amounts, and it should not. See image attached.

So in this example, the correct Base for Tax calculation should be 118.80+21.75=140.55, therefore the correct VAT tax base amount of that transaction is 117.13 and the correct tax amount 23.43.
In this example it we sum-up all the amounts, there will be a rounding issue comparing with the "original" gross prices sum (145.50) vs [117.13 (net VAT prices) + 23.43 (VAT) + 4.95 (EcoTax)] = 145.51, we will have to some how adjust.

Having said that:

We need confirmation of below two topics:


* the assumption that end-customers providing gross prices in their price list including both VAT and EcoTax is correct
* the assumption that not taking into account EcoTax amounts in net prices of VAT calculations is correct.

(0141445)
hgbot   
2022-09-28 14:23   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/merge_requests/941 [^]
(0145155)
hgbot   
2023-01-04 08:46   
Merge Request created: https://gitlab.com/openbravo/ci/mobile-test/-/merge_requests/254 [^]
(0145833)
hgbot   
2023-01-25 13:13   
Merge Request created: https://gitlab.com/openbravo/product/pmods/org.openbravo.taxes/-/merge_requests/15 [^]
(0145988)
hgbot   
2023-01-30 08:18   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/merge_requests/941 [^]
(0145989)
hgbot   
2023-01-30 08:18   
Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal [^]
Changeset: 132e3f3b51dc1674bcf5ca3193db957b3681d3b4
Author: Javier <javieretxarri@ekinbe.com>
Date: 30-01-2023 07:18:48
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.retail.posterminal/-/commit/132e3f3b51dc1674bcf5ca3193db957b3681d3b4 [^]

Fixes ISSUE-46314: Net prices must be used when having exempt BP and price list including taxes

---
A web-test/model/business-object/ticket/actions/SetBusinessPartner.test.js
A web/org.openbravo.retail.posterminal/app/model/business-object/ticket/actions/SetBusinessPartner.js
M src/org/openbravo/retail/posterminal/OBPOSComponentProvider.java
M web-test/model/business-object/ticket/CalculateTotalsModelHook.test.js
M web-test/model/business-object/ticket/actions/SetLinePrice.test.js
M web/org.openbravo.retail.posterminal/app/model/business-logic/taxes-engine/engine/tax-engine.js
M web/org.openbravo.retail.posterminal/app/model/business-object/ticket/TicketUtils.js
M web/org.openbravo.retail.posterminal/app/model/business-object/ticket/actions/CreateTicketFromQuotation.js
M web/org.openbravo.retail.posterminal/app/model/business-object/ticket/actions/SetLinePrice.js
M web/org.openbravo.retail.posterminal/js/model/order.js
---
(0145990)
hgbot   
2023-01-30 08:19   
Repository: https://gitlab.com/openbravo/ci/mobile-test [^]
Changeset: 87d4b82ff537ca2548139e446c6d7a03110d369d
Author: Javier <javieretxarri@ekinbe.com>
Date: 30-01-2023 07:19:54
URL: https://gitlab.com/openbravo/ci/mobile-test/-/commit/87d4b82ff537ca2548139e446c6d7a03110d369d [^]

Related to ISSUE-46314: Net prices must be used when having exempt BP and price list including taxes

---
M src-test/org/openbravo/test/mobile/retail/extmodules/selenium/tests/taxexempt/TaxExemptBP.java
M src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/layaway/I37384_VerifyCustomerCreditLimit.java
M src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/multipricelists/I32217_MPLDiscountOnlyForOneCustomerAndDifferentTaxes.java
M src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/orderselector/VerifyOrderSelector.java
M src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/prepaymentsAndInvoiceTerms/OMNI010_CreateLayawayAfterOrderDelivery.java
M src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/prepaymentsAndInvoiceTerms/OMNI050_PayOpenTicketsAmountToLayawayAfterOrderDelivery.java
M src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/prepaymentsAndInvoiceTerms/OMNI070_CancelLayawayUndeliverableProductPrepaymentWithApprovalAfterOrderDelivery.java
M src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/prepaymentsAndInvoiceTerms/OMNI080_CancelLayawayServiceAsPerProductUndeliverableProductPrepaymentWithApprovalAfterOrderDelivery.java
M src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/receipts/I36243_ChangeDefaultBPLocation.java
M src-test/org/openbravo/test/mobile/retail/pack/selenium/tests/receipts/I36920_GoodsShipmentBusinessPartnerWithDifferentAddresses.java
---
(0145991)
hgbot   
2023-01-30 08:19   
Merge request merged: https://gitlab.com/openbravo/ci/mobile-test/-/merge_requests/254 [^]
(0145992)
hgbot   
2023-01-30 08:20   
Repository: https://gitlab.com/openbravo/product/pmods/org.openbravo.taxes [^]
Changeset: 02c5c4399068adbf62e69da1539dcf9b9eb7f82e
Author: Javier <javieretxarri@ekinbe.com>
Date: 30-01-2023 07:20:50
URL: https://gitlab.com/openbravo/product/pmods/org.openbravo.taxes/-/commit/02c5c4399068adbf62e69da1539dcf9b9eb7f82e [^]

Related to ISSUE-46314: Net prices must be used when having exempt BP and price list including taxes

---
A src-test/org/openbravo/taxes/test/data/TaxesTestData57.java
A src-test/org/openbravo/taxes/test/data/TaxesTestData58.java
M src-test/org/openbravo/taxes/test/base/model/Ticket.java
M src-test/org/openbravo/taxes/test/unittests/TaxesTest.java
---
(0145993)
hgbot   
2023-01-30 08:20   
Merge request merged: https://gitlab.com/openbravo/product/pmods/org.openbravo.taxes/-/merge_requests/15 [^]