details: /erp/devel/pi/rev/bc42f5aa4e93
changeset: 8565:bc42f5aa4e93
user: Sivaraman Rajagopal <sivaraman.rajagopal <at> openbravo.com>
date: Tue Oct 19 18:09:39 2010 +0530
summary: Fixes issue 14564: Writeoff accounting error in settlements
Root cause:
It can be found AcctServer.ACCTTYPE_WriteOffDefault account type that was used
earlier in DocPayment.java. That's why it was always taking the write off line
at accounting schema level.
Solution:
Simply changing the account type from ACCTTYPE_WriteOffDefault to
ACCTTYPE_WriteOff in WRITEOFF calculation would not work as C_BPartner_ID in
AcctServer is nowhere populated with value (Please note, C_BPartner_ID is used
in AcctServer.getAccount method). Therefore, the code has been modified in
order to directly create Account object rather than calling getAccount method.
This will resolve the issue as per the expected behaviour without any impacts.
diffstat:
src/org/openbravo/erpCommon/ad_forms/DocPayment.java | 30 +++++++++++++++++--
1 files changed, 26 insertions(+), 4 deletions(-)
diffs (40 lines):
diff -r d60f21a50638 -r bc42f5aa4e93
src/org/openbravo/erpCommon/ad_forms/DocPayment.java
--- a/src/org/openbravo/erpCommon/ad_forms/DocPayment.java Tue Oct 19
09:24:18 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_forms/DocPayment.java Tue Oct 19
18:09:39 2010 +0530
@@ -320,10 +320,32 @@
// debt-payments
if (line.WriteOffAmt != null && !line.WriteOffAmt.equals("")
&& !line.WriteOffAmt.equals("0")) {
- fact.createLine(line,
getAccount(AcctServer.ACCTTYPE_WriteOffDefault, as, conn),
- C_Currency_ID, (line.isReceipt.equals("Y") ? line.WriteOffAmt :
""), (line.isReceipt
- .equals("Y") ? "" : line.WriteOffAmt), Fact_Acct_Group_ID,
nextSeqNo(SeqNo),
- DocumentType, conn);
+ String Account_ID = "";
+ AcctServerData[] acctData = AcctServerData.selectWriteOffAcct(conn,
line.C_BPARTNER_ID,
+ as.getC_AcctSchema_ID());
+ if (acctData != null && acctData.length != 0) {
+ Account_ID = acctData[0].accountId;
+ } else {
+ acctData = AcctServerData.selectWriteOffDefault(conn,
as.getC_AcctSchema_ID());
+ if (acctData != null && acctData.length != 0) {
+ Account_ID = acctData[0].accountId;
+ }
+ }
+ Account acct = null;
+ if (!Account_ID.equals("")) {
+ try {
+ acct = Account.getAccount(conn, Account_ID);
+ } catch (ServletException e) {
+ log4j.warn(e);
+ e.printStackTrace();
+ }
+ } else {
+ log4j.warn("AcctServer - getAccount - NO account Type=" +
AcctServer.ACCTTYPE_WriteOff
+ + ", Record=" + Record_ID);
+ }
+ fact.createLine(line, acct, C_Currency_ID,
(line.isReceipt.equals("Y") ? line.WriteOffAmt
+ : ""), (line.isReceipt.equals("Y") ? "" : line.WriteOffAmt),
Fact_Acct_Group_ID,
+ nextSeqNo(SeqNo), DocumentType, conn);
}
}
------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits