changeset: 33415:9bf627820d9e
user:      Mark <markmm82 <at>>
date:      Fri Feb 09 09:43:33 2018 +0100
summary:   Fixes issue 37823: Sales tax selected in Return To Vendor if the 
returned goods
receipt does not have a purchase order related

A wrong sales tax was selected in Return To Vendor if the returned goods receipt
does not have a purchase order related.

The Tax field has the Tax Id value of the receipt line being copied, in case
that the good receipt line was created from an order then it will have the tax 
used on the order line. But in case the goods receipt line was created 
manually, as
it lines aren't related to any order lines, the tax received will be NULL, so 
it is
needed to get the default Tax to be used in the new generated returned line.

In the case of a Return to Vendor is needed to return the default Purchase Tax 
of the
product. In the case of Return from Customer is neede to use the default Sales 
of the product. It was fixed passing this parameter taking into account the 
order is sales transaction or not.


 src/org/openbravo/common/actionhandler/ |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r 7a23607a0b6c -r 9bf627820d9e 
--- a/src/org/openbravo/common/actionhandler/     Fri Feb 
09 09:15:50 2018 +0100
+++ b/src/org/openbravo/common/actionhandler/     Fri Feb 
09 09:43:33 2018 +0100
@@ -52,6 +52,7 @@
 import org.openbravo.service.db.CallStoredProcedure;
 import org.openbravo.service.db.DalConnectionProvider;
 import org.openbravo.service.db.DbUtility;
+import org.openbravo.service.json.JsonUtils;
@@ -213,7 +214,7 @@
         tax = shipmentLine.getSalesOrderLine().getTax();
       } else {
         String taxId = "";
-        if (selectedLine.get("tax").equals(null) || 
selectedLine.get("tax").equals("")) {
+        if (JsonUtils.isValueEmpty(selectedLine.get("tax").toString())) {
           List<Object> parameters = new ArrayList<Object>();
@@ -228,7 +229,7 @@
           } else {
-          parameters.add("Y");
+          parameters.add(order.isSalesTransaction() ? "Y" : "N");
           taxId = (String) CallStoredProcedure.getInstance().call("C_Gettax", 
parameters, null);
           if (taxId == null || "".equals(taxId)) {

Check out the vibrant tech community on one of the world's most
engaging tech sites,!
Openbravo-commits mailing list

Reply via email to