From cbfc3ac88f205194830580ac3196452a9088c2db Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Tue, 21 Feb 2017 11:59:50 +0100 Subject: [PATCH] IDEMPIERE-3281 Wrong Tax Correction posting at Write Off / integrate patch from Anton Fildan --- .../org/compiere/acct/Doc_AllocationHdr.java | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_AllocationHdr.java b/org.adempiere.base/src/org/compiere/acct/Doc_AllocationHdr.java index 6934a93025..a82746bc1a 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc_AllocationHdr.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc_AllocationHdr.java @@ -1049,10 +1049,17 @@ class Doc_AllocationTax total, m_WriteOffAmt, precision); if (amount.signum() != 0) { - fact.createLine (line, m_WriteOffAccount, - as.getC_Currency_ID(), amount, null); - fact.createLine (line, taxAcct, - as.getC_Currency_ID(), null, amount); + if (m_IsSOTrx) { + fact.createLine (line, m_WriteOffAccount, + as.getC_Currency_ID(), amount, null); + fact.createLine (line, taxAcct, + as.getC_Currency_ID(), null, amount); + } else { + fact.createLine (line, m_WriteOffAccount, + as.getC_Currency_ID(), amount.negate(), null); + fact.createLine (line, taxAcct, + as.getC_Currency_ID(), null, amount.negate()); + } } } // Original Tax is CR - need to correct it DR @@ -1062,10 +1069,17 @@ class Doc_AllocationTax total, m_WriteOffAmt, precision); if (amount.signum() != 0) { - fact.createLine (line, taxAcct, - as.getC_Currency_ID(), amount, null); - fact.createLine (line, m_WriteOffAccount, - as.getC_Currency_ID(), null, amount); + if(m_IsSOTrx) { + fact.createLine (line, taxAcct, + as.getC_Currency_ID(), amount, null); + fact.createLine (line, m_WriteOffAccount, + as.getC_Currency_ID(), null, amount); + } else { + fact.createLine (line, taxAcct, + as.getC_Currency_ID(), amount.negate(), null); + fact.createLine (line, m_WriteOffAccount, + as.getC_Currency_ID(), null, amount.negate()); + } } } } // WriteOff