# HG changeset patch
# User Víctor Martínez Romanos <victor.martinez@openbravo.com>
# Date 1427369973 -3600
# Node ID 1dbdd6cd22884a721a9005d78586aeb97d00fa05
# Parent  df6eaf978ff87c00925ca8d83bf98575d5171628
Related to issue 29389: removed useless stuff found in code review,
the updatePaymentAmounts() method contained useless code to check whether it's necessary to update the PS amounts or not. This code is not available in PI, and I have verified that after removing it the bug is still fixed.
Removed and synchronized this method with PI

diff --git a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java
@@ -1406,30 +1406,12 @@
       creditUsed = creditUsed.subtract(amountWithSign);
       bPartner.setCreditUsed(creditUsed);
       OBDal.getInstance().save(bPartner);
-      // Check whether there is need to update the amounts
-      BigDecimal paymentScheduleDetailInvAmt = BigDecimal.ZERO;
-      for (FIN_PaymentScheduleDetail paymentScheduleDetail : psd.getInvoicePaymentSchedule()
-          .getFINPaymentScheduleDetailInvoicePaymentScheduleList()) {
-        paymentScheduleDetailInvAmt = paymentScheduleDetailInvAmt.add(paymentScheduleDetail
-            .getAmount());
-      }
-      if (paymentScheduleDetailInvAmt.compareTo(psd.getInvoicePaymentSchedule().getAmount()) != 0) {
-        FIN_AddPayment.updatePaymentScheduleAmounts(psd.getPaymentDetails(),
-            psd.getInvoicePaymentSchedule(), psd.getAmount(), psd.getWriteoffAmount());
-      }
+      FIN_AddPayment.updatePaymentScheduleAmounts(psd.getPaymentDetails(),
+          psd.getInvoicePaymentSchedule(), psd.getAmount(), psd.getWriteoffAmount());
     }
     if (psd.getOrderPaymentSchedule() != null) {
-      // Check whether there is need to update amount
-      BigDecimal paymentScheduleDetailOrdAmt = BigDecimal.ZERO;
-      for (FIN_PaymentScheduleDetail paymentScheduleDetail : psd.getOrderPaymentSchedule()
-          .getFINPaymentScheduleDetailOrderPaymentScheduleList()) {
-        paymentScheduleDetailOrdAmt = paymentScheduleDetailOrdAmt.add(paymentScheduleDetail
-            .getAmount());
-      }
-      if (paymentScheduleDetailOrdAmt.compareTo(psd.getOrderPaymentSchedule().getAmount()) != 0) {
-        FIN_AddPayment.updatePaymentScheduleAmounts(psd.getPaymentDetails(),
-            psd.getOrderPaymentSchedule(), psd.getAmount(), psd.getWriteoffAmount());
-      }
+      FIN_AddPayment.updatePaymentScheduleAmounts(psd.getPaymentDetails(),
+          psd.getOrderPaymentSchedule(), psd.getAmount(), psd.getWriteoffAmount());
     }
     if (psd.getPaymentDetails().isPrepayment() && psd.getOrderPaymentSchedule() == null
         && psd.getInvoicePaymentSchedule() == null) {
