details: https://code.openbravo.com/erp/devel/pi/rev/7f011c2b82df changeset: 35222:7f011c2b82df user: Mark <markmm82 <at> gmail.com> date: Tue Dec 04 15:24:47 2018 -0500 summary: Fixed issue 39676: Error when calculating the taxes in the "Copy from Orders" process.
Executing the "Copy from Order" process, the bill partner location was calculated in the UpdateTax.getMaxBusinessPartnerLocationId() method, taking the maximum value of the bussiness Partner? locations. Now it will use the Bill Location of the order if defined or the last partner address in other case, similar to the flow when the line is created manually and the SL_Order_Product callout is called. diffstat: src/org/openbravo/common/actionhandler/copyfromorderprocess/UpdateTax.java | 15 ++++++---- 1 files changed, 9 insertions(+), 6 deletions(-) diffs (53 lines): diff -r 699e368e6274 -r 7f011c2b82df src/org/openbravo/common/actionhandler/copyfromorderprocess/UpdateTax.java --- a/src/org/openbravo/common/actionhandler/copyfromorderprocess/UpdateTax.java Tue Dec 04 09:22:11 2018 +0100 +++ b/src/org/openbravo/common/actionhandler/copyfromorderprocess/UpdateTax.java Tue Dec 04 15:24:47 2018 -0500 @@ -11,7 +11,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU - * All portions are Copyright (C) 2017 Openbravo SLU + * All portions are Copyright (C) 2017-2018 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -26,6 +26,8 @@ import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.time.DateFormatUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.hibernate.criterion.Projections; import org.hibernate.criterion.Restrictions; import org.openbravo.base.exception.OBException; @@ -41,8 +43,6 @@ import org.openbravo.model.common.plm.Product; import org.openbravo.model.financialmgmt.tax.TaxRate; import org.openbravo.service.db.DalConnectionProvider; -import org.apache.logging.log4j.Logger; -import org.apache.logging.log4j.LogManager; @Dependent @Qualifier(CopyFromOrdersProcessImplementationInterface.COPY_FROM_ORDER_PROCESS_HOOK_QUALIFIER) @@ -78,7 +78,10 @@ * @throws ServletException */ private String getCurrentTaxId(final Product product, final Order processingOrder) { - String bpLocationId = getMaxBusinessPartnerLocationId(processingOrder.getBusinessPartner()); + String bpBillToLocationId = (processingOrder.getInvoiceAddress() != null) ? processingOrder + .getInvoiceAddress().getId() : getMaxBusinessPartnerLocationId(processingOrder + .getBusinessPartner()); + String bpLocationId = processingOrder.getPartnerAddress().getId(); String orderWarehouseId = processingOrder.getWarehouse() != null ? processingOrder .getWarehouse().getId() : ""; String orderProjectId = processingOrder.getProject() != null ? processingOrder.getProject() @@ -89,8 +92,8 @@ String taxID; try { taxID = Tax.get(new DalConnectionProvider(), product.getId(), strDatePromised, - processingOrder.getOrganization().getId(), orderWarehouseId, bpLocationId, bpLocationId, - orderProjectId, processingOrder.isSalesTransaction()); + processingOrder.getOrganization().getId(), orderWarehouseId, bpBillToLocationId, + bpLocationId, orderProjectId, processingOrder.isSalesTransaction()); } catch (IOException | ServletException e) { log.error("Error in CopyFromOrdersProcess while retrieving the TaxID for a Product", e); throw new OBException(e); _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits