[Doubtful Debt] Fixes FIN_PaymentProcess
authorEduardo Argal Guibert <eduardo.argal@openbravo.com>
Fri, 11 Jan 2013 12:06:58 +0100
changeset 19567 b361d0040ff3
parent 19566 0192e05b4f00
child 19568 27ae7d0d932e
[Doubtful Debt] Fixes FIN_PaymentProcess
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java	Fri Jan 11 11:11:53 2013 +0100
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java	Fri Jan 11 12:06:58 2013 +0100
@@ -641,8 +641,10 @@
                   FIN_PaymentScheduleDetail outstandingPSD = (FIN_PaymentScheduleDetail) DalUtil
                       .copy(paymentScheduleDetail, false);
                   outstandingPSD.setAmount(psdWriteoffAmount);
-                  outstandingDebtAmount = paymentScheduleDetail.getDoubtfulDebtAmount().subtract(
-                      paymentScheduleDetail.getAmount());
+                  if (paymentScheduleDetail.getDoubtfulDebtAmount().signum() != 0) {
+                    outstandingDebtAmount = paymentScheduleDetail.getDoubtfulDebtAmount().subtract(
+                        paymentScheduleDetail.getAmount());
+                  }
                   outstandingPSD.setDoubtfulDebtAmount(outstandingDebtAmount);
                   outstandingPSD.setWriteoffAmount(BigDecimal.ZERO);
                   outstandingPSD.setPaymentDetails(null);