Openbravo Issue Tracking System - Openbravo Localizations
View Issue Details
0046262Openbravo LocalizationsLocalization Portugalpublic2021-04-14 09:002021-04-27 15:46
psanjuan 
markmm82 
urgentmajoralways
closedfixed 
30Openbravo Appliance 14.04
 
 
0046262: SAFT code must export the region search key if a tax rate has a region setup
SAFT code must export the region search key if a tax rate has a region setup
In an PT enviroment with the SAFT code installed and the Portuguese taxes applied, create some sales transactions and export the e-fatura file.
While reviwing the file you will see below data en the tag TaxCountryCode

<TaxCountryRegion>Algarve</TaxCountryRegion>


Above is not the correct value expected, but the region code or RegionValue.

in the Openbravo regions dataset, all PT regions have PT as RegionValue, but Acores and Madeira, that have PT-AC and PT-MA, respectively.
No tags attached.
related to defect 0046260 closed markmm82 Wrong region code for Açores and Madeira regions. Rest of regions need to have the code PT 
related to defect 0047501 closed vmromanos TaxCountryRegion value 'Madeira' is not a valid instance of the element type error in org.openbravo.saftpt.wscommunication 
Issue History
2021-04-14 09:00psanjuanNew Issue
2021-04-14 09:00psanjuanAssigned To => psanjuan
2021-04-14 10:31maiteResolution time => 1620165600
2021-04-14 10:31maiteIssue Monitored: maite
2021-04-19 12:54aferrazAssigned Topsanjuan => markmm82
2021-04-19 14:43markmm82Statusnew => scheduled
2021-04-19 19:11markmm82Note Added: 0127375
2021-04-19 19:13markmm82Note Added: 0127376
2021-04-20 14:07psanjuanRelationship addedrelated to 0046260
2021-04-20 14:08psanjuanNote Added: 0127386
2021-04-20 17:12markmm82Note Edited: 0127375bug_revision_view_page.php?bugnote_id=0127375#r22348
2021-04-20 17:16markmm82Note Edited: 0127376bug_revision_view_page.php?bugnote_id=0127376#r22350
2021-04-23 14:07aferrazNote Added: 0127500
2021-04-23 14:07aferrazStatusscheduled => resolved
2021-04-23 14:07aferrazResolutionopen => fixed
2021-04-23 14:31aferrazNote Deleted: 0127500
2021-04-23 14:37hgbotNote Added: 0127508
2021-04-23 14:37aferrazStatusresolved => closed
2021-04-23 14:40hgbotStatusclosed => resolved
2021-04-23 14:40hgbotNote Added: 0127509
2021-04-23 14:55aferrazStatusresolved => closed
2021-04-26 09:37hgbotStatusclosed => resolved
2021-04-26 09:37hgbotNote Added: 0127530
2021-04-27 15:46aferrazStatusresolved => closed
2021-08-12 12:43vmromanosRelationship addedrelated to 0047501

Notes
(0127375)
markmm82   
2021-04-19 19:11   
(edited on: 2021-04-20 17:12)
Test Plan 1: Tax rate with tax region defined different than Portugal Iso Code

In an PT enviroment with the SAFT code installed and the Portuguese taxes applied, create a sales order, add a line and use a tax rate defined for "Portugal" country and "Açores" region. Complete the document.

Create a new E-Fatura record for the organization used for the previously created order, select this month and use "today" as from and to dates.

Create a new "Process request" and schedule to run immediately the "Export SAFT PT" process. Execute it.

Go to previously created e-fatura. Notice a new document was attached to it related to exported e-fatura.

If you download and review the file you will see below data en the tag TaxCountryCode:
<TaxCountryRegion>PT-AC</TaxCountryRegion>

This is correct as the selected tax rate has a Acora as the defined region and this region has "AC" as region search code that is different than default Portugla regions search code: PT

(0127376)
markmm82   
2021-04-19 19:13   
(edited on: 2021-04-20 17:16)
Test Plan 2: Tax rate without tax region defined or with tax region search key = PT

In an PT enviroment with the SAFT code installed and the Portuguese taxes applied, create a sales order, add a line and use a tax rate defined for "Portugal" country but without any region defined. Complete the document.

Create another sales order, add a line and use a tax rate defined for "Portugal" country, this time with any region defined different than AC and MA. Complete the document.

Create a new E-Fatura record for the organization used for the previously created order, select this month and use "today" as from and to dates.

Create a new "Process request" and schedule to run immediately the "Export SAFT PT" process. Execute it.

Go to previously created e-fatura. Notice a new document was attached to it related to the exported e-fatura.

If you download and review the file you will see below data en the tag TaxCountryCode:
<TaxCountryRegion>PT</TaxCountryRegion>

This is correct as the selected tax rate doesn't has any region defined (for the first order) and the country code is the same than the region search key for the second one.

(0127386)
psanjuan   
2021-04-20 14:08   
Updated solution
For those regions where Country ISO Code "PT" is equal to the region code "PT", only export "PT".
For those regions where Country ISO Code "PT" is not equal to the region code "AT", export a concatenate value = PT-AC (Country ISO Code - Region Code)
(0127508)
hgbot   
2021-04-23 14:37   
Repository: https://gitlab.com/openbravo/product/pmods/com.practicsbs.saftpt [^]
Changeset: 0258635fdfebbc5997564ac987a7db866d50c129
Author: Mark <markmm82@gmail.com>
Date: 2021-04-23T08:54:11-03:00
URL: https://gitlab.com/openbravo/product/pmods/com.practicsbs.saftpt/-/commit/0258635fdfebbc5997564ac987a7db866d50c129 [^]

Fixes ISSUE-46262: Correct TaxCountryRegion value when exporting e-fatura document

If exported documents are using a tax with a region defined, then the tax region code will be set as the value of the <TaxCountryRegion> tag.
If the tax rate region search key is the same than the country ISO code, then the country ISO Code will be used.
In case the tax rate region search key is not the same than the country ISO code, then the country ISO Code concatenated with the region search key will be used as TaxCountryRegion tag value

---
M src/com/practicsbs/saftpt/data/ExportMFTaxTable.java
M src/com/practicsbs/saftpt/data/ExportSourceDocs.java
M src/com/practicsbs/saftpt/data/ExportSourceDocsPayments.java
M src/com/practicsbs/saftpt/data/ExportSourceDocsWorkingDocuments.java
M src/com/practicsbs/saftpt/data/TaxTable_data.xsql
---
(0127509)
hgbot   
2021-04-23 14:40   
Repository: https://gitlab.com/openbravo/product/pmods/com.practicsbs.saftpt [^]
Changeset: 0258635fdfebbc5997564ac987a7db866d50c129
Author: Mark <markmm82@gmail.com>
Date: 2021-04-23T08:54:11-03:00
URL: https://gitlab.com/openbravo/product/pmods/com.practicsbs.saftpt/-/commit/0258635fdfebbc5997564ac987a7db866d50c129 [^]

Fixes ISSUE-46262: Correct TaxCountryRegion value when exporting e-fatura document

If exported documents are using a tax with a region defined, then the tax region code will be set as the value of the <TaxCountryRegion> tag.
If the tax rate region search key is the same than the country ISO code, then the country ISO Code will be used.
In case the tax rate region search key is not the same than the country ISO code, then the country ISO Code concatenated with the region search key will be used as TaxCountryRegion tag value

---
M src/com/practicsbs/saftpt/data/ExportMFTaxTable.java
M src/com/practicsbs/saftpt/data/ExportSourceDocs.java
M src/com/practicsbs/saftpt/data/ExportSourceDocsPayments.java
M src/com/practicsbs/saftpt/data/ExportSourceDocsWorkingDocuments.java
M src/com/practicsbs/saftpt/data/TaxTable_data.xsql
---
(0127530)
hgbot   
2021-04-26 09:37   
Repository: https://gitlab.com/openbravo/product/pmods/com.practicsbs.saftpt [^]
Changeset: 0258635fdfebbc5997564ac987a7db866d50c129
Author: Mark <markmm82@gmail.com>
Date: 2021-04-23T08:54:11-03:00
URL: https://gitlab.com/openbravo/product/pmods/com.practicsbs.saftpt/-/commit/0258635fdfebbc5997564ac987a7db866d50c129 [^]

Fixes ISSUE-46262: Correct TaxCountryRegion value when exporting e-fatura document

If exported documents are using a tax with a region defined, then the tax region code will be set as the value of the <TaxCountryRegion> tag.
If the tax rate region search key is the same than the country ISO code, then the country ISO Code will be used.
In case the tax rate region search key is not the same than the country ISO code, then the country ISO Code concatenated with the region search key will be used as TaxCountryRegion tag value

---
M src/com/practicsbs/saftpt/data/ExportMFTaxTable.java
M src/com/practicsbs/saftpt/data/ExportSourceDocs.java
M src/com/practicsbs/saftpt/data/ExportSourceDocsPayments.java
M src/com/practicsbs/saftpt/data/ExportSourceDocsWorkingDocuments.java
M src/com/practicsbs/saftpt/data/TaxTable_data.xsql
---