Fixes issue 17937: The error message is not clear
authorJavier Etxarri <javier.echarri@openbravo.com>
Fri, 22 Jul 2011 10:07:49 +0200
changeset 13251 9122806c6732
parent 13250 f0e06340b593
child 13252 f02e66320312
Fixes issue 17937: The error message is not clear
src/org/openbravo/erpCommon/ad_forms/DocInOut.java
--- a/src/org/openbravo/erpCommon/ad_forms/DocInOut.java	Fri Jul 22 10:20:52 2011 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/DocInOut.java	Fri Jul 22 10:07:49 2011 +0200
@@ -223,23 +223,26 @@
           dr = fact.createLine(line, line.getAccount(ProductInfo.ACCTTYPE_P_Asset, as, conn),
               as.getC_Currency_ID(), strCosts, "", Fact_Acct_Group_ID, nextSeqNo(SeqNo),
               DocumentType, conn);
-          dr.setM_Locator_ID(line.m_M_Locator_ID);
-          dr.setLocationFromBPartner(C_BPartner_Location_ID, true, conn); // from
-          // Loc
-          dr.setLocationFromLocator(line.m_M_Locator_ID, false, conn); // to
-          // Loc
-          log4jDocInOut.debug("(matReceipt) - CR account: "
-              + line.getAccount(AcctServer.ACCTTYPE_NotInvoicedReceipts, as, conn));
-          log4jDocInOut.debug("(matReceipt) - CR costs: " + strCosts);
-          // NotInvoicedReceipt CR
-          cr = fact.createLine(line, getAccount(AcctServer.ACCTTYPE_NotInvoicedReceipts, as, conn),
-              as.getC_Currency_ID(), "", strCosts, Fact_Acct_Group_ID, nextSeqNo(SeqNo),
-              DocumentType, conn);
-          cr.setM_Locator_ID(line.m_M_Locator_ID);
-          cr.setLocationFromBPartner(C_BPartner_Location_ID, true, conn); // from
-          // Loc
-          cr.setLocationFromLocator(line.m_M_Locator_ID, false, conn); // to
-          // Loc
+          if (!getStatus().equals("i")) {
+            dr.setM_Locator_ID(line.m_M_Locator_ID);
+            dr.setLocationFromBPartner(C_BPartner_Location_ID, true, conn); // from
+            // Loc
+            dr.setLocationFromLocator(line.m_M_Locator_ID, false, conn); // to
+            // Loc
+            log4jDocInOut.debug("(matReceipt) - CR account: "
+                + line.getAccount(AcctServer.ACCTTYPE_NotInvoicedReceipts, as, conn));
+            log4jDocInOut.debug("(matReceipt) - CR costs: " + strCosts);
+            // NotInvoicedReceipt CR
+            cr = fact.createLine(line,
+                getAccount(AcctServer.ACCTTYPE_NotInvoicedReceipts, as, conn),
+                as.getC_Currency_ID(), "", strCosts, Fact_Acct_Group_ID, nextSeqNo(SeqNo),
+                DocumentType, conn);
+            cr.setM_Locator_ID(line.m_M_Locator_ID);
+            cr.setLocationFromBPartner(C_BPartner_Location_ID, true, conn); // from
+            // Loc
+            cr.setLocationFromLocator(line.m_M_Locator_ID, false, conn); // to
+            // Loc
+          }
         }
       }
     } else {