Related to bug 29265: Delete obaprmAllRecordsSelectedByUser in OrderInvoice Load
authorUnai Martirena <unai.martirena@openbravo.com>
Tue, 17 Mar 2015 20:08:08 +0100
changeset 26204 f400d595dc52
parent 26202 fe1d0d1cf4ba
child 26205 e7c1d9e51ba8
Related to bug 29265: Delete obaprmAllRecordsSelectedByUser in OrderInvoice Load

While executing invalidateCache() function to reload OrderInvoice grid it internally calls to 'OB.APRM.AddPayment.deselectAllRecords' overriden method that sets obaprmAllRecordsSelectedByUser property to true. This property is only needed when manually the select/unselect all checkbox is clicked.

This was causing on certain scenarios that methods to update totals were not being called:
* OB.APRM.AddPayment.updateInvOrderTotal(view.theForm, orderInvoice);
* OB.APRM.AddPayment.updateActualExpected(view.theForm);
* OB.APRM.AddPayment.updateDifference(view.theForm);

So, in order to avoid this in OrderInvoiceOnLoad function, if the property 'obaprmAllRecordsSelectedByUser' exists, it will be deleted.
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 09:26:06 2015 +0100
+++ b/modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-addPayment.js	Tue Mar 17 20:08:08 2015 +0100
@@ -301,6 +301,9 @@
   var issotrx = this.view.theForm.getItem('issotrx').getValue(),
       payment = this.view.theForm.getItem('fin_payment_id').getValue();
   grid.isReady = true;
+  if (grid.obaprmAllRecordsSelectedByUser) {
+    delete grid.obaprmAllRecordsSelectedByUser;
+  }
   if ((issotrx || !payment) && (grid.selectedIds.length === 0)) {
     OB.APRM.AddPayment.distributeAmount(this.view, this.view.theForm, false);
   } else {