Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0046770
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] 03. Procurement managementmajoralways2021-05-21 04:122021-06-15 11:41
ReporterlbressanView Statuspublic 
Assigned Tomarkmm82 
PriorityhighResolutionfixedFixed in VersionPR21Q3
StatusclosedFix in branchFixed in SCM revision
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned To
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0046770: Bad tax calculated in Purchase Order lines with multi-country business partner

DescriptionWhen using a multi-country Business Partner in a purchase order, the taxes of the lines are not selected correctly, regardless of the Tax Location.

The problem is caused by the BillTo_ID field, which is not visible in the purchase order, but which takes the value of the first of the addresses.
org.openbravo.erpCommon.ad_callouts.SE_Order_BPartner
...
    // Bill to

    if (strLocation != null && !strLocation.isEmpty()) {
      info.addResult("inpbilltoId", strLocation);
    }
...
This field is not present in the purchase order, so it cannot be changed even if the Partner Address field is changed to another country.

This field is then used for the calculation in the C_GetTax Database function.

org.openbravo.erpCommon.ad_callouts.SL_Order_Product
...
        try {
          String strCTaxID = Tax.get(this, strMProductID, data[0].dateordered, strADOrgID,
              strMWarehouseID,
              (StringUtils.isEmpty(data[0].billtoId) ? strCBPartnerLocationID : data[0].billtoId),
              strCBPartnerLocationID, data[0].cProjectId, StringUtils.equals(strIsSOTrx, "Y"),
              StringUtils.equals(data[0].iscashvat, "Y"));
          info.addResult("inpcTaxId", strCTaxID);
        }
...

org.openbravo.erpCommon.ad_callouts
SL_Order_Tax_data.xsql
...
  <SqlMethod name="select" type="preparedStatement" return="multiple">
    <SqlMethodComment></SqlMethodComment>
    <Sql>
      <![CDATA[
      SELECT C_Order.BillTo_ID, C_Order.DateOrdered, C_Order.C_Project_ID, C_Order.IsCashVat
      FROM C_Order
      WHERE C_Order_ID = ?
      ]]>
    </Sql>
...

org.openbravo.erpCommon.businessUtility
Tax_data.xsql
...
   <SqlMethod name="taxGet" type="preparedStatement" return="String" default="">
      <SqlMethodComment></SqlMethodComment>
      <Sql><![CDATA[
        SELECT C_GetTax(?, TO_DATE(?), ?, ?, ?, ?, ?, ?, ?, ?) AS TAX FROM DUAL
      ]]></Sql>
...
Steps To Reproduce1. Enter the Back Office to any Client-Organization (Example: The White Valley Group-Category Tree Store)
2. Choose a Business Partner and add an address from a country different from the other countries of the other Locations that it has. (Example: Mountains & Snow S.L has addresses from Spain, add an address from France, with all empty fields except the country)
3. Create a new Tax Category.
4. Create new Tax Rates for this Tax Category between the country of all the Business Partner Locations and the country of the Organization (In this example: Category Tree Store is from Spain, add Tax Rates Spain-Spain, Spain -France and France-Spain).
5. Assign that Tax Category to a Product (Example: Alpine ski boot).
6. Create a Purchase Order with the chosen Organization.
7. Add the chosen Business Partner. (It should load by default the new Location created)
8. Change Partner Location.
9. Add a line.
10. Select the chosen product.
11. Check which Tax is charged on the line.
12. Delete the line.
13. Change Partner Location.
14. Repeat the test on the line.
Proposed Solution1. Use org.openbravo.erpCommon.ad_callouts.SE_Order_BPartnerLocation to update BillTo_ID to the appropriate value.
2. Correct the callout to select the correct address from the C_Order for the Purchase Orders.
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
(0129289)
markmm82 (developer)
2021-06-09 22:30
edited on: 2021-06-10 15:43

Test Plan:
1. Login as The White Valley Group client and select Category Tree Store org as defaults.
2. Go to Business Partner window and select Mountains & Snow S.L.
  2.1 Notice he already has a spain address.
  2.2 Create a new address for France with all empty fields except the country.
3. Create a new Tax Category.
  Organization = Category Tree Store
  Name = Issue46770TaxCategory
4. Create three new Tax Rates for this Tax Category:
  4.1 To be applied from Spain to Spain:
     Organization = Category Tree Store
     Name = SpainSpain
     Tax Category = Issue46770TaxCategory
     Rate = 10
     Country = Destination Country = Spain
  4.2 To be applied from Spain to France:
     Organization = Category Tree Store
     Name = SpainFrance
     Rate = 20
     Tax Category = Issue46770TaxCategory
     Country = Spain
     Destination Country = France
  4.1 To be applied from France to Spain:
     Organization = Category Tree Store
     Name = FranceSpain
     Rate = 30
     Tax Category = Issue46770TaxCategory
     Country = France
     Destination Country = Spain
5. Assign that "Issue46770TaxCategory" Tax Category to "Alpine ski boot" product.
6. Create a Purchase Order
   Organization = Category Tree Store
   Business Partner = Mountains & Snow S.L
   Notice it loads by default the new Location created for France

   Go to "More Information" section and be sure that same location is selected for the Invoice Address.
7. Add a line.
8. Select the "Alpine ski boot" product.
  Notice that "FranceSpain" tax is selected by default in the Tax field.
  This is correct as BP invoice address belongs to France.
9. Delete the line.
10. Go to header an change invoice address by selecting Spain location (.Zaragoza, Plaza Mayor 2).
11. Add a line.
12. Select the "Alpine ski boot" product.
  Notice that "SpainSpain" tax is selected by default in the Tax field.
  This is correct as BP invoice address belongs to Spain.
13. Add quantity and complete the order.
  Notice the process ends successfully.

Repeat the test for Sales Orders.

(0129293)
hgbot (developer)
2021-06-10 01:15

Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/387 [^]
(0129349)
hgbot (developer)
2021-06-10 14:32

Merge request closed: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/387 [^]
(0129364)
hgbot (developer)
2021-06-10 18:02

Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/389 [^]
(0129371)
hgbot (developer)
2021-06-11 00:04

Merge request closed: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/389 [^]
(0129372)
hgbot (developer)
2021-06-11 00:14

Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/390 [^]
(0129413)
hgbot (developer)
2021-06-11 14:25

Merge request closed: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/390 [^]
(0129422)
hgbot (developer)
2021-06-11 23:01

Merge Request created: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/394 [^]
(0129510)
hgbot (developer)
2021-06-15 11:41

Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: 1a40d11a29609c0f0c0bc0f7a0b0877fcb067ba5
Author: Mark Orlando Molina <markmm82@gmail.com>
Date: 2021-06-15T09:41:00+00:00
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/1a40d11a29609c0f0c0bc0f7a0b0877fcb067ba5 [^]

Fixes BUG-46770: Displayed "Invoice from" field in Purchase Order window

---
M modules/org.openbravo.v3/src-db/database/configScript.xml
M src-db/database/sourcedata/AD_FIELD.xml
---
(0129511)
hgbot (developer)
2021-06-15 11:41

Merge request merged: https://gitlab.com/openbravo/product/openbravo/-/merge_requests/394 [^]

- Issue History
Date Modified Username Field Change
2021-05-21 04:12 lbressan New Issue
2021-05-21 04:12 lbressan Assigned To => Triage Finance
2021-05-21 04:12 lbressan Modules => Core
2021-05-21 04:12 lbressan Resolution time => 1623276000
2021-05-21 04:12 lbressan Triggers an Emergency Pack => No
2021-05-21 11:30 vmromanos Assigned To Triage Finance => markmm82
2021-05-21 21:05 lbressan Description Updated View Revisions
2021-06-09 18:13 markmm82 Status new => scheduled
2021-06-09 22:30 markmm82 Note Added: 0129289
2021-06-10 01:15 hgbot Note Added: 0129293
2021-06-10 14:32 hgbot Note Added: 0129349
2021-06-10 15:43 markmm82 Note Edited: 0129289 View Revisions
2021-06-10 18:02 hgbot Note Added: 0129364
2021-06-11 00:04 hgbot Note Added: 0129371
2021-06-11 00:14 hgbot Note Added: 0129372
2021-06-11 14:25 hgbot Note Added: 0129413
2021-06-11 23:01 hgbot Note Added: 0129422
2021-06-15 11:41 hgbot Resolution open => fixed
2021-06-15 11:41 hgbot Status scheduled => closed
2021-06-15 11:41 hgbot Fixed in Version => PR21Q3
2021-06-15 11:41 hgbot Note Added: 0129510
2021-06-15 11:41 hgbot Note Added: 0129511


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker