Integrate phib's change from trunk revision 5693
BF [ 2019262 ] Allocation posting currency gain/loss omits line reference
This commit is contained in:
parent
b032e1051a
commit
9f3e5592d7
|
@ -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. *
|
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* 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 *
|
* 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 Receipt and both accounts Unallocated Cash and Receivable are equal
|
||||||
* Avoid posting if Payment and both accounts Payment Select and Liability 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
|
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() != as.getC_Currency_ID() // payment allocation in foreign currency
|
||||||
|| getC_Currency_ID() != line.getInvoiceC_Currency_ID())) // allocation <> invoice currency
|
|| getC_Currency_ID() != line.getInvoiceC_Currency_ID())) // allocation <> invoice currency
|
||||||
{
|
{
|
||||||
p_Error = createRealizedGainLoss (as, fact, bpAcct, invoice,
|
p_Error = createRealizedGainLoss (line, as, fact, bpAcct, invoice,
|
||||||
allocationSourceForRGL, allocationAccountedForRGL);
|
allocationSource, allocationAccounted);
|
||||||
if (p_Error != null)
|
if (p_Error != null)
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -694,7 +697,7 @@ public class Doc_Allocation extends Doc
|
||||||
* @param allocationAccounted acct amt
|
* @param allocationAccounted acct amt
|
||||||
* @return Error Message or null if OK
|
* @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)
|
MInvoice invoice, BigDecimal allocationSource, BigDecimal allocationAccounted)
|
||||||
{
|
{
|
||||||
BigDecimal invoiceSource = null;
|
BigDecimal invoiceSource = null;
|
||||||
|
@ -794,18 +797,18 @@ public class Doc_Allocation extends Doc
|
||||||
//
|
//
|
||||||
if (invoice.isSOTrx())
|
if (invoice.isSOTrx())
|
||||||
{
|
{
|
||||||
FactLine fl = fact.createLine (null, loss, gain,
|
FactLine fl = fact.createLine (line, loss, gain,
|
||||||
as.getC_Currency_ID(), acctDifference);
|
as.getC_Currency_ID(), acctDifference);
|
||||||
fl.setDescription(description);
|
fl.setDescription(description);
|
||||||
fact.createLine (null, acct,
|
fact.createLine (line, acct,
|
||||||
as.getC_Currency_ID(), acctDifference.negate());
|
as.getC_Currency_ID(), acctDifference.negate());
|
||||||
fl.setDescription(description);
|
fl.setDescription(description);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fact.createLine (null, acct,
|
fact.createLine (line, acct,
|
||||||
as.getC_Currency_ID(), acctDifference);
|
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());
|
as.getC_Currency_ID(), acctDifference.negate());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in New Issue