diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_MatchInv.java b/org.adempiere.base/src/org/compiere/acct/Doc_MatchInv.java index da6f38add4..632b18bccf 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc_MatchInv.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc_MatchInv.java @@ -403,6 +403,16 @@ public class Doc_MatchInv extends Doc as.getC_Currency_ID(), ipv.negate()); updateFactLine(line); + line = fact.createLine(null, account, as.getC_Currency_ID(), ipv); + updateFactLine(line); + } else if (X_M_Cost.COSTINGMETHOD_AverageInvoice.equals(costingMethod) && !zeroQty) { + MAccount account = m_pc.getAccount(ProductCost.ACCTTYPE_P_Asset, as); + + FactLine line = fact.createLine(null, + m_pc.getAccount(ProductCost.ACCTTYPE_P_IPV, as), + as.getC_Currency_ID(), ipv.negate()); + updateFactLine(line); + line = fact.createLine(null, account, as.getC_Currency_ID(), ipv); updateFactLine(line); } diff --git a/org.adempiere.base/src/org/compiere/model/MInvoice.java b/org.adempiere.base/src/org/compiere/model/MInvoice.java index 5ac7f638ed..069c02478d 100644 --- a/org.adempiere.base/src/org/compiere/model/MInvoice.java +++ b/org.adempiere.base/src/org/compiere/model/MInvoice.java @@ -1828,6 +1828,18 @@ public class MInvoice extends X_C_Invoice implements DocAction matchPO++; 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); + + MMatchInv[] matchInvoices = MMatchInv.getInvoiceLine(getCtx(), line.getC_InvoiceLine_ID(), get_TrxName()); + if (matchInvoices != null && matchInvoices.length > 0) + { + for(MMatchInv matchInvoice : matchInvoices) + { + if (!matchInvoice.isPosted()) + { + addDocsPostProcess(matchInvoice); + } + } + } } } }