Fixes issue 33470: Right invoice amount when Add Payment from Match Statement
authorMark <markmm82@gmail.com>
Wed, 13 Jul 2016 09:45:27 -0400
changeset 30090 eddbad5c182e
parent 30089 be7ed445aa54
child 30091 a9de7947f68d
Fixes issue 33470: Right invoice amount when Add Payment from Match Statement

Invoice amount is populated when running Add Payment from Add Transaction from Match Statement process, and the amount field is set to invoice's amount instead of to zero when specific invoice is selected.
modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-addPayment.js
--- a/modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-addPayment.js	Tue Jul 05 11:49:24 2016 +0200
+++ b/modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-addPayment.js	Wed Jul 13 09:45:27 2016 -0400
@@ -571,7 +571,6 @@
       selectedIds = orderInvoice.selectedIds,
       glitem = new BigDecimal(String(view.theForm.getItem('amount_gl_items').getValue() || 0)),
       credit = new BigDecimal(String(view.theForm.getItem('used_credit').getValue() || 0)),
-      bslamount = new BigDecimal(String(view.theForm.getItem('bslamount').getValue() || 0)),
       i;
 
   amount = amount.subtract(distributedAmount);
@@ -601,16 +600,7 @@
   } else {
     for (i = 0; i < selectedIds.length; i++) {
       if (selectedIds[i] === record.id) {
-        if (bslamount.compareTo(BigDecimal.prototype.ZERO) !== 0) {
-          if (outstandingAmount.compareTo(amount) > 0) {
-            orderInvoice.setEditValue(orderInvoice.getRecordIndex(record), 'amount', Number(amount.toString()));
-          } else {
-            orderInvoice.setEditValue(orderInvoice.getRecordIndex(record), 'amount', Number(outstandingAmount.toString()));
-          }
-        } else {
-          orderInvoice.setEditValue(orderInvoice.getRecordIndex(record), 'amount', Number(outstandingAmount.toString()));
-        }
-
+        orderInvoice.setEditValue(orderInvoice.getRecordIndex(record), 'amount', Number(outstandingAmount.toString()));
       }
     }
   }
@@ -646,7 +636,6 @@
       generateCredit = new BigDecimal(String(form.getItem('generateCredit').getValue() || 0)),
       glitemtotal = new BigDecimal(String(form.getItem('amount_gl_items').getValue() || 0)),
       credit = new BigDecimal(String(form.getItem('used_credit').getValue() || 0)),
-      bslamount = new BigDecimal(String(form.getItem('bslamount').getValue() || 0)),
       selectedRecords = orderInvoice.selectedIds,
       actpayment, i;
   for (i = 0; i < selectedRecords.length; i++) {