From 46585842d2b35106e12a676fa79c4f0f397a6e23 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 17 Jul 2013 19:47:09 -0500 Subject: [PATCH] IDEMPIERE-1174 Found avg po cost detail record was not being created when following flow PO->Inv->Receipt - force the posting of matchpo just when receipt is associated --- .../src/org/compiere/acct/Doc_MatchPO.java | 9 +++++++-- org.adempiere.base/src/org/compiere/model/MInvoice.java | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) 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); } }