From 23d595b1f53836d3db4f59b84680418feccb79ff Mon Sep 17 00:00:00 2001 From: phib Date: Wed, 19 Nov 2008 00:19:41 +0000 Subject: [PATCH] Bugs item #2312109 Match Inv Posting fails if invoice line value zero https://sourceforge.net/tracker/?func=detail&atid=879332&aid=2312109&group_id=176962 --- base/src/org/compiere/acct/Doc_MatchInv.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/base/src/org/compiere/acct/Doc_MatchInv.java b/base/src/org/compiere/acct/Doc_MatchInv.java index 70d836b3c0..40b04eec85 100644 --- a/base/src/org/compiere/acct/Doc_MatchInv.java +++ b/base/src/org/compiere/acct/Doc_MatchInv.java @@ -205,6 +205,24 @@ public class Doc_MatchInv extends Doc { log.fine("Line Net Amt=0 - M_Product_ID=" + getM_Product_ID() + ",Qty=" + getQty() + ",InOutQty=" + m_receiptLine.getMovementQty()); + + // Invoice Price Variance + BigDecimal ipv = dr.getSourceBalance().negate(); + if (ipv.signum() != 0) + { + MInvoice m_invoice = m_invoiceLine.getParent(); + int C_Currency_ID = m_invoice.getC_Currency_ID(); + FactLine pv = fact.createLine(null, + m_pc.getAccount(ProductCost.ACCTTYPE_P_IPV, as), + C_Currency_ID, ipv); + pv.setC_Activity_ID(m_invoiceLine.getC_Activity_ID()); + pv.setC_Campaign_ID(m_invoiceLine.getC_Campaign_ID()); + pv.setC_Project_ID(m_invoiceLine.getC_Project_ID()); + pv.setC_UOM_ID(m_invoiceLine.getC_UOM_ID()); + pv.setUser1_ID(m_invoiceLine.getUser1_ID()); + pv.setUser2_ID(m_invoiceLine.getUser2_ID()); + } + log.fine("IPV=" + ipv + "; Balance=" + fact.getSourceBalance()); facts.add(fact); return facts; }