related to issue 29147
authorSandra Huguet <sandra.huguet@openbravo.com>
Wed, 18 Mar 2015 17:17:38 +0100
changeset 26207 b7fd6844f03f
parent 26206 0e985fcaf97d
child 26208 14b642262f27
related to issue 29147

the validation only has to be considered when overpayment combo is visible
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 Mar 18 14:37:23 2015 +0000
+++ b/modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-addPayment.js	Wed Mar 18 17:17:38 2015 +0100
@@ -1069,7 +1069,8 @@
       amountInvOrds = new BigDecimal(String(view.theForm.getItem('amount_inv_ords').getValue() || 0)),
       total = new BigDecimal(String(view.theForm.getItem('total').getValue() || 0)),
       actualPayment = new BigDecimal(String(view.theForm.getItem('actual_payment').getValue() || 0)),
-      overpaymentAction = view.theForm.getItem('overpayment_action').getValue(),
+      overpaymentField= view.theForm.getItem('overpayment_action'),
+      overpaymentAction = overpaymentField.getValue(),
       creditTotalItem = new BigDecimal(String(view.theForm.getItem('used_credit').getValue() || 0)),
       document = (view.theForm.getItem('trxtype')) ? view.theForm.getItem('trxtype').getValue() : "",
       amountField = orderInvoiceGrid.getFieldByColumnName('amount'),
@@ -1119,7 +1120,7 @@
     return false;
   }
 
-  if ((total.compareTo(creditTotalItem) < 0) && (overpaymentAction === 'CR')) {
+  if ((total.compareTo(creditTotalItem) < 0) && (overpaymentField.isVisible() && overpaymentAction === 'CR')) {
     view.messageBar.setMessage(isc.OBMessageBar.TYPE_ERROR, null, OB.I18N.getLabel('APRM_MORECREDITAMOUNT'));
     return false;
   }