From 9f3e5592d7288a7886c152f2a3af1d25c83c7f38 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Tue, 29 Jul 2008 07:30:00 +0000 Subject: [PATCH] Integrate phib's change from trunk revision 5693 BF [ 2019262 ] Allocation posting currency gain/loss omits line reference --- .../src/org/compiere/acct/Doc_Allocation.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/base/src/org/compiere/acct/Doc_Allocation.java b/base/src/org/compiere/acct/Doc_Allocation.java index 007c2881a2..53ffc5d35e 100644 --- a/base/src/org/compiere/acct/Doc_Allocation.java +++ b/base/src/org/compiere/acct/Doc_Allocation.java @@ -1,5 +1,5 @@ /****************************************************************************** - * Product: Adempiere ERP & CRM Smart Business Solution * + * Product: Adempiere ERP & CRM Smart Business Solution * * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * * under the terms version 2 of the GNU General Public License as published * @@ -51,6 +51,9 @@ import org.compiere.util.Env; * Avoid posting if Receipt and both accounts Unallocated Cash and Receivable are equal * Avoid posting if Payment and both accounts Payment Select and Liability are equal * + * @author phib + * BF [ 2019262 ] Allocation posting currency gain/loss omits line reference + * */ public class Doc_Allocation extends Doc { @@ -427,8 +430,8 @@ public class Doc_Allocation extends Doc && (getC_Currency_ID() != as.getC_Currency_ID() // payment allocation in foreign currency || getC_Currency_ID() != line.getInvoiceC_Currency_ID())) // allocation <> invoice currency { - p_Error = createRealizedGainLoss (as, fact, bpAcct, invoice, - allocationSourceForRGL, allocationAccountedForRGL); + p_Error = createRealizedGainLoss (line, as, fact, bpAcct, invoice, + allocationSource, allocationAccounted); if (p_Error != null) return null; } @@ -694,7 +697,7 @@ public class Doc_Allocation extends Doc * @param allocationAccounted acct amt * @return Error Message or null if OK */ - private String createRealizedGainLoss (MAcctSchema as, Fact fact, MAccount acct, + private String createRealizedGainLoss (DocLine line, MAcctSchema as, Fact fact, MAccount acct, MInvoice invoice, BigDecimal allocationSource, BigDecimal allocationAccounted) { BigDecimal invoiceSource = null; @@ -794,18 +797,18 @@ public class Doc_Allocation extends Doc // if (invoice.isSOTrx()) { - FactLine fl = fact.createLine (null, loss, gain, + FactLine fl = fact.createLine (line, loss, gain, as.getC_Currency_ID(), acctDifference); fl.setDescription(description); - fact.createLine (null, acct, + fact.createLine (line, acct, as.getC_Currency_ID(), acctDifference.negate()); fl.setDescription(description); } else { - fact.createLine (null, acct, + fact.createLine (line, acct, as.getC_Currency_ID(), acctDifference); - FactLine fl = fact.createLine (null, loss, gain, + FactLine fl = fact.createLine (line, loss, gain, as.getC_Currency_ID(), acctDifference.negate()); } return null;