IDEMPIERE-3702 Post if clearing is equal is not working on AP Payments AP2-140 / fix NPE when payment is zero

This commit is contained in:
Carlos Ruiz 2018-05-21 20:00:05 +02:00
parent 8c2088ba80
commit b38367ee2f
1 changed files with 13 additions and 11 deletions

View File

@ -171,20 +171,22 @@ public class Doc_Payment extends Doc
// Avoid usage of clearing accounts
// If both accounts and orgs are the same then remove the posting
MAccount acct_dr = dr.getAccount();
MAccount acct_cr = cr.getAccount();
int org_dr = dr.getAD_Org_ID();
int org_cr = cr.getAD_Org_ID();
if (!as.isPostIfClearingEqual() && acct_dr!=null && acct_dr.equals(acct_cr) && org_dr == org_cr) {
if (dr != null && cr != null) {
MAccount acct_dr = dr.getAccount();
MAccount acct_cr = cr.getAccount();
int org_dr = dr.getAD_Org_ID();
int org_cr = cr.getAD_Org_ID();
if (!as.isPostIfClearingEqual() && acct_dr!=null && acct_dr.equals(acct_cr) && org_dr == org_cr) {
BigDecimal debit = dr.getAmtSourceDr();
BigDecimal credit = cr.getAmtSourceCr();
BigDecimal debit = dr.getAmtSourceDr();
BigDecimal credit = cr.getAmtSourceCr();
if (debit.compareTo(credit) == 0) {
fact.remove(dr);
fact.remove(cr);
}
if (debit.compareTo(credit) == 0) {
fact.remove(dr);
fact.remove(cr);
}
}
// End Avoid usage of clearing accounts
//