Fixes issue 0018056: Business partner selector in Add Payment window fires the reload of the results in every change
authorAdrián Romero <adrianromero@openbravo.com>
Thu, 18 Aug 2011 13:05:42 +0200
changeset 13581 ff6655a3b321
parent 13580 d61db4a5e84b
child 13582 0cf02944934f
Fixes issue 0018056: Business partner selector in Add Payment window fires the reload of the results in every change
It has been added a check that only fires the reload of the data when the parameters change
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromTransaction.html
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromTransaction.html	Thu Aug 18 13:04:35 2011 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/ad_actionbutton/AddPaymentFromTransaction.html	Thu Aug 18 13:05:42 2011 +0200
@@ -52,6 +52,7 @@
   OB.APRM.APFT_GLItems = [];
   OB.APRM.APFT_GLItemsId = 0;
   OB.APRM.HasGLItems = false;
+  OB.APRM.APFT_bp = null;
 function callBackGrid(paramXMLParticular, XMLHttpRequestObj) {
   var strText = '';
   if (getReadyStateHandler(XMLHttpRequestObj)) {
@@ -87,13 +88,38 @@
   }
   return true;
 }
+
 function loadGridList() {
-  try {
-    var url = '../org.openbravo.advpaymentmngt.ad_actionbutton/AddPaymentFromTransaction.html';
-    var paramXMLReq = null;
-    return submitXmlHttpRequest(callBackGrid, document.frmMain, 'GRIDLIST', url, false, null, paramXMLReq);
-  } catch (e) {
-    alert(e);
+  if (OB.APRM.APFT_bp === null ||
+      OB.APRM.APFT_bp !== frmMain['inpcBpartnerId'].value ||
+      OB.APRM.APFT_fa !== frmMain['inpFinancialAccountId'].value ||
+      OB.APRM.APFT_ddf !== frmMain['inpDueDateFrom'].value ||
+      OB.APRM.APFT_ddt !== frmMain['inpDueDateTo'].value ||
+      OB.APRM.APFT_tdf !== frmMain['inpTransDateFrom'].value ||
+      OB.APRM.APFT_tdt !== frmMain['inpTransDateTo'].value ||
+      OB.APRM.APFT_dt !== frmMain['inpDocumentType'].value ||
+      OB.APRM.APFT_cu !== frmMain['inpCurrencyId'].value ||
+      OB.APRM.APFT_dn !== frmMain['inpDocumentNo'].value ||
+      OB.APRM.APFT_re !== frmMain['isReceipt'].value) {
+
+    OB.APRM.APFT_bp = frmMain['inpcBpartnerId'].value;
+    OB.APRM.APFT_fa = frmMain['inpFinancialAccountId'].value;
+    OB.APRM.APFT_ddf = frmMain['inpDueDateFrom'].value;
+    OB.APRM.APFT_ddt = frmMain['inpDueDateTo'].value;
+    OB.APRM.APFT_tdf = frmMain['inpTransDateFrom'].value;
+    OB.APRM.APFT_tdt = frmMain['inpTransDateTo'].value;
+    OB.APRM.APFT_dt = frmMain['inpDocumentType'].value;
+    OB.APRM.APFT_cu = frmMain['inpCurrencyId'].value;
+    OB.APRM.APFT_dn = frmMain['inpDocumentNo'].value;
+    OB.APRM.APFT_re = frmMain['isReceipt'].value;
+
+	  try {
+	    var url = '../org.openbravo.advpaymentmngt.ad_actionbutton/AddPaymentFromTransaction.html';
+	    var paramXMLReq = null;
+	    return submitXmlHttpRequest(callBackGrid, document.frmMain, 'GRIDLIST', url, false, null, paramXMLReq);
+	  } catch (e) {
+	    alert(e);
+	  }
   }
 }
 function callBackPaymentMethod(paramXMLParticular, XMLHttpRequestObj) {