diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_MatchPO.java b/org.adempiere.base/src/org/compiere/acct/Doc_MatchPO.java index daecc82367..f62e68820d 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc_MatchPO.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc_MatchPO.java @@ -126,14 +126,19 @@ public class Doc_MatchPO extends Doc ArrayList facts = new ArrayList(); // if (getM_Product_ID() == 0 // Nothing to do if no Product - || getQty().signum() == 0 - || m_M_InOutLine_ID == 0) // No posting if not matched to Shipment + || getQty().signum() == 0) { if (log.isLoggable(Level.FINE)) log.fine("No Product/Qty - M_Product_ID=" + getM_Product_ID() + ",Qty=" + getQty()); return facts; } + if (m_M_InOutLine_ID == 0) // No posting if not matched to Shipment + { + p_Error = "No posting if not matched to Shipment"; + return null; + } + // create Fact Header Fact fact = new Fact(this, as, Fact.POST_Actual); setC_Currency_ID(as.getC_Currency_ID()); diff --git a/org.adempiere.base/src/org/compiere/model/MInvoice.java b/org.adempiere.base/src/org/compiere/model/MInvoice.java index 45cff928e0..be7f08cd7a 100644 --- a/org.adempiere.base/src/org/compiere/model/MInvoice.java +++ b/org.adempiere.base/src/org/compiere/model/MInvoice.java @@ -1849,7 +1849,7 @@ public class MInvoice extends X_C_Invoice implements DocAction return DocAction.STATUS_Invalid; } matchPO++; - if (!po.isPosted()) + if (!po.isPosted() && po.getM_InOutLine_ID() > 0) // match po don't post if receipt is not assigned, and it doesn't create avg po record addDocsPostProcess(po); } }