Fixes issue 30138: Error when generating credit and adding a negative line
authorAlvaro Ferraz <alvaro.ferraz@openbravo.com>
Wed, 10 Jun 2015 16:55:01 +0200
changeset 26898 3eaa0f22f0db
parent 26897 aab70f0c1a50
child 26900 aba1a9d25e4d
child 26902 559a6242635c
Fixes issue 30138: Error when generating credit and adding a negative line

Add Payment was raising an error if credit used was greater than total amount.
Now, this comprobation will only be done if some record has been selected in Credit To Use grid.
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	Wed Jun 10 22:46:44 2015 +0000
+++ b/modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-addPayment.js	Wed Jun 10 16:55:01 2015 +0200
@@ -1137,7 +1137,7 @@
     return clientSideValidationFail();
   }
 
-  if ((total.compareTo(creditTotalItem) < 0) && (overpaymentField.isVisible() && overpaymentAction === 'CR')) {
+  if (creditTotalItem.compareTo(BigDecimal.prototype.ZERO) !== 0 && (total.compareTo(creditTotalItem) < 0) && (overpaymentField.isVisible() && overpaymentAction === 'CR')) {
     view.messageBar.setMessage(isc.OBMessageBar.TYPE_ERROR, null, OB.I18N.getLabel('APRM_MORECREDITAMOUNT'));
     return clientSideValidationFail();
   }