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

View Revisions: Issue #46770 All Revisions ] Back to Issue ]
Summary 0046770: Bad tax calculated in Purchase Order lines with multi-country business partner
Revision 2021-05-21 21:05 by lbressan
Description When 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>
...
Revision 2021-05-21 11:30 by lbressan
Description When using a multi-country third party 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>
...


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker