From a36239a8d9e714d58e6ad7d788f3380aff6032e8 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 16 Oct 2013 16:52:29 -0500 Subject: [PATCH] IDEMPIERE-1447 Posting fails on reversal shipment with services --- .../src/org/compiere/acct/Doc_InOut.java | 14 +++++++++++++- .../src/org/compiere/impexp/ImpFormat.java | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_InOut.java b/org.adempiere.base/src/org/compiere/acct/Doc_InOut.java index 4ed5eb844b..aca0dcd910 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc_InOut.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc_InOut.java @@ -296,6 +296,7 @@ public class Doc_InOut extends Doc for (int i = 0; i < p_lines.length; i++) { DocLine line = p_lines[i]; + MProduct product = line.getProduct(); BigDecimal costs = null; if (!isReversal(line)) { @@ -306,7 +307,6 @@ public class Doc_InOut extends Doc if (costs == null || costs.signum() == 0) // zero costs OK { - MProduct product = line.getProduct(); if (product.isStocked()) { p_Error = "No Costs for " + line.getProduct().getName(); @@ -340,6 +340,10 @@ public class Doc_InOut extends Doc if (!dr.updateReverseLine (MInOut.Table_ID, m_Reversal_ID, line.getReversalLine_ID(),Env.ONE)) { + if (! product.isStocked()) { // ignore service + fact.remove(dr); + continue; + } p_Error = "Original Shipment/Receipt not posted yet"; return null; } @@ -502,6 +506,10 @@ public class Doc_InOut extends Doc if (!dr.updateReverseLine (MInOut.Table_ID, m_Reversal_ID, line.getReversalLine_ID(),Env.ONE)) { + if (! product.isStocked()) { // ignore service + fact.remove(dr); + continue; + } p_Error = "Original Receipt not posted yet"; return null; } @@ -615,6 +623,10 @@ public class Doc_InOut extends Doc if (!dr.updateReverseLine (MInOut.Table_ID, m_Reversal_ID, line.getReversalLine_ID(),Env.ONE)) { + if (! product.isStocked()) { // ignore service + fact.remove(dr); + continue; + } p_Error = "Original Receipt not posted yet"; return null; } diff --git a/org.adempiere.base/src/org/compiere/impexp/ImpFormat.java b/org.adempiere.base/src/org/compiere/impexp/ImpFormat.java index 7fe5ce75a6..ed0840b4ff 100644 --- a/org.adempiere.base/src/org/compiere/impexp/ImpFormat.java +++ b/org.adempiere.base/src/org/compiere/impexp/ImpFormat.java @@ -154,6 +154,7 @@ public final class ImpFormat { m_tableUnique1 = "UPC"; // UPC = unique m_tableUnique2 = "Value"; + // must validate both fields - if one is empty don't check m_tableUniqueChild = "VendorProductNo"; // Vendor No may not be unique ! m_tableUniqueParent = "BPartner_Value"; // Makes it unique }