From c0808dd049d9c4cfb31e178d4f6839701fdd416c Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Mon, 27 Feb 2017 10:38:19 +0100 Subject: [PATCH] IDEMPIERE-3306 Product Type=Service Posting with price variation --- .../src/org/compiere/acct/Doc_MatchInv.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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 eb47d489ef..c4545b976f 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc_MatchInv.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc_MatchInv.java @@ -402,9 +402,12 @@ public class Doc_MatchInv extends Doc } String costingMethod = m_pc.getProduct().getCostingMethod(as); + MAccount account = m_pc.getAccount(ProductCost.ACCTTYPE_P_Asset, as); + if (m_pc.isService()) + account = m_pc.getAccount(ProductCost.ACCTTYPE_P_Expense, as); if (X_M_Cost.COSTINGMETHOD_AveragePO.equals(costingMethod)) { - MAccount account = zeroQty ? m_pc.getAccount(ProductCost.ACCTTYPE_P_AverageCostVariance, as) : m_pc.getAccount(ProductCost.ACCTTYPE_P_Asset, as); - + if (zeroQty) + account = m_pc.getAccount(ProductCost.ACCTTYPE_P_AverageCostVariance, as); FactLine line = fact.createLine(null, m_pc.getAccount(ProductCost.ACCTTYPE_P_IPV, as), as.getC_Currency_ID(), ipv.negate()); @@ -413,8 +416,6 @@ public class Doc_MatchInv extends Doc 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());