Fixed bug 29124 It is not possible to create PaymentOut from "match statement"
authorSandra Huguet <sandra.huguet@openbravo.com>
Wed, 04 Mar 2015 17:07:47 +0100
changeset 26134 4ee0aae2bc57
parent 26133 486e7700e8d0
child 26135 d8ec9347e127
Fixed bug 29124 It is not possible to create PaymentOut from "match statement"

It is not possible to create Payment Out from "match statement" using
a G/L item.
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	Fri Mar 06 08:10:31 2015 +0100
+++ b/modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-addPayment.js	Wed Mar 04 17:07:47 2015 +0100
@@ -622,11 +622,7 @@
     expectedPayment.setValue(Number('0'));
   }
   if (!issotrx) {
-    if ((bslamount.compareTo(BigDecimal.prototype.ZERO) !== 0) && (totalAmount.compareTo(BigDecimal.prototype.ZERO) === 0)) {
-      actpayment = totalAmount.add(glitemtotal).add(generateCredit).add(bslamount.abs());
-    } else {
-      actpayment = totalAmount.add(glitemtotal).add(generateCredit);
-    }
+    actpayment = totalAmount.add(glitemtotal).add(generateCredit);
     actualPayment.setValue(Number(actpayment));
     if (credit.compareTo(BigDecimal.prototype.ZERO) > 0) {
       if (credit.compareTo(actpayment) > 0) {
@@ -635,6 +631,14 @@
         actualPayment.setValue(Number(actpayment.subtract(credit)));
       }
     }
+    if ((bslamount.compareTo(BigDecimal.prototype.ZERO) !== 0)) {
+      if (actpayment.compareTo(BigDecimal.prototype.ZERO) === 0) {
+        actpayment = actpayment.add(bslamount.abs());
+      } else {
+        actpayment = bslamount.abs();
+      }
+      actualPayment.setValue(Number(actpayment));
+    }
     OB.APRM.AddPayment.updateDifference(form);
     OB.APRM.AddPayment.updateConvertedAmount(null, form, false);
   }