From 926e00a5ce81ac55c4c405ae4f737106f37ff2c9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Mon, 31 May 2021 16:07:54 +0900
Subject: [PATCH] payment_mean: rename "mode" argument for erp5_hal_json
 compatibility

For same reasons as f692aa6145 ([erp5_bank_reconciliation] Rename
your_mode field, to prevent naming conflict in hal, 2019-10-23)
---
 ...nsactionGroup_getGroupablePaymentTransactionLineList.py | 7 ++++---
 ...sactionGroup_getGroupablePaymentTransactionLineList.xml | 2 +-
 ...entTransactionGroup_selectPaymentTransactionLineList.py | 2 +-
 ...ntTransactionGroup_selectPaymentTransactionLineList.xml | 2 +-
 ...nsactionGroup_selectPaymentTransactionLineListActive.py | 6 +++---
 ...sactionGroup_selectPaymentTransactionLineListActive.xml | 2 +-
 ...ionGroup_viewSelectPaymentTransactionLineListDialog.xml | 2 +-
 .../{your_mode.xml => your_select_mode.xml}                | 2 +-
 .../test.erp5.testPaymentTransactionGroup.py               | 6 +++---
 .../testPaymentTransactionGroupSelectPaymentsFastInput.zpt | 4 ++++
 ...ctionGroupSelectPlannedOrConfirmedPaymentsFastInput.zpt | 4 ++--
 ...ctionGroupSelectPlannedOrConfirmedPaymentsFastInput.zpt | 4 ++--
 12 files changed, 24 insertions(+), 19 deletions(-)
 rename bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_viewSelectPaymentTransactionLineListDialog/{your_mode.xml => your_select_mode.xml} (99%)

diff --git a/bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_getGroupablePaymentTransactionLineList.py b/bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_getGroupablePaymentTransactionLineList.py
index 2c72e0cbfa..fb43abe8f7 100644
--- a/bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_getGroupablePaymentTransactionLineList.py
+++ b/bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_getGroupablePaymentTransactionLineList.py
@@ -1,12 +1,13 @@
 portal = context.getPortalObject()
 
-if mode is None:
+if select_mode is None:
   # To show an empty listbox the first time the dialog is open
+  container.REQUEST.set('PaymentTransactionGroup_statGroupablePaymentTransactionLineList.total_quantity', None)
   return []
-elif mode == 'stopped_or_delivered':
+elif select_mode == 'stopped_or_delivered':
   simulation_state = ('delivered', 'stopped')
 else:
-  assert mode == 'planned_or_confirmed', "Unknown mode, %r" % mode
+  assert select_mode == 'planned_or_confirmed', "Unknown select_mode, %r" % select_mode
   simulation_state = ('planned', 'confirmed')
 
 search_kw = dict(
diff --git a/bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_getGroupablePaymentTransactionLineList.xml b/bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_getGroupablePaymentTransactionLineList.xml
index 2104a471fa..ae8d973469 100644
--- a/bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_getGroupablePaymentTransactionLineList.xml
+++ b/bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_getGroupablePaymentTransactionLineList.xml
@@ -50,7 +50,7 @@
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>select_limit=None, start_date_range_min=None, start_date_range_max=None, sign=None, mode=None, Movement_getMirrorSectionTitle=None, **kw</string> </value>
+            <value> <string>select_limit=None, start_date_range_min=None, start_date_range_max=None, sign=None, select_mode=None, Movement_getMirrorSectionTitle=None, **kw</string> </value>
         </item>
         <item>
             <key> <string>id</string> </key>
diff --git a/bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_selectPaymentTransactionLineList.py b/bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_selectPaymentTransactionLineList.py
index 7f7689ac78..6b43d8bce0 100644
--- a/bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_selectPaymentTransactionLineList.py
+++ b/bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_selectPaymentTransactionLineList.py
@@ -13,7 +13,7 @@ context.activate(tag=tag).PaymentTransactionGroup_selectPaymentTransactionLineLi
   start_date_range_min=start_date_range_min,
   start_date_range_max=start_date_range_max,
   sign=sign,
-  mode=mode,
+  select_mode=select_mode,
   Movement_getMirrorSectionTitle=listbox_Movement_getMirrorSectionTitle,
   tag=tag)
 
diff --git a/bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_selectPaymentTransactionLineList.xml b/bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_selectPaymentTransactionLineList.xml
index 7a77ace850..c0e9dd4365 100644
--- a/bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_selectPaymentTransactionLineList.xml
+++ b/bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_selectPaymentTransactionLineList.xml
@@ -50,7 +50,7 @@
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>uids=(), form_id=\'view\', select_limit=None, start_date_range_min=None, start_date_range_max=None, sign=None, mode=None, listbox_Movement_getMirrorSectionTitle=None, **kw</string> </value>
+            <value> <string>uids=(), form_id=\'view\', select_limit=None, start_date_range_min=None, start_date_range_max=None, sign=None, select_mode=None, listbox_Movement_getMirrorSectionTitle=None, **kw</string> </value>
         </item>
         <item>
             <key> <string>id</string> </key>
diff --git a/bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_selectPaymentTransactionLineListActive.py b/bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_selectPaymentTransactionLineListActive.py
index 2bb975ac9a..b39be2874c 100644
--- a/bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_selectPaymentTransactionLineListActive.py
+++ b/bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_selectPaymentTransactionLineListActive.py
@@ -16,13 +16,13 @@ else:
         start_date_range_min=start_date_range_min,
         start_date_range_max=start_date_range_max,
         sign=sign,
-        mode=mode,
+        select_mode=select_mode,
         Movement_getMirrorSectionTitle=Movement_getMirrorSectionTitle,)]
 
-if mode == 'stopped_or_delivered':
+if select_mode == 'stopped_or_delivered':
   method_id = 'AccountingTransactionLine_addPaymentTransactionGroup'
 else:
-  assert mode == 'planned_or_confirmed', "Unknown mode, %r" % mode
+  assert select_mode == 'planned_or_confirmed', "Unknown select_mode, %r" % select_mode
   method_id = 'AccountingTransactionLine_stopAndAddPaymentTransactionGroup'
 
 
diff --git a/bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_selectPaymentTransactionLineListActive.xml b/bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_selectPaymentTransactionLineListActive.xml
index f032101861..b97ca9324f 100644
--- a/bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_selectPaymentTransactionLineListActive.xml
+++ b/bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_selectPaymentTransactionLineListActive.xml
@@ -50,7 +50,7 @@
         </item>
         <item>
             <key> <string>_params</string> </key>
-            <value> <string>uids=(), select_limit=None, start_date_range_min=None, start_date_range_max=None, sign=None, mode=None, Movement_getMirrorSectionTitle=None, tag=\'\'</string> </value>
+            <value> <string>uids=(), select_limit=None, start_date_range_min=None, start_date_range_max=None, sign=None, select_mode=None, Movement_getMirrorSectionTitle=None, tag=\'\'</string> </value>
         </item>
         <item>
             <key> <string>_proxy_roles</string> </key>
diff --git a/bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_viewSelectPaymentTransactionLineListDialog.xml b/bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_viewSelectPaymentTransactionLineListDialog.xml
index 98cf0cd28c..72908e8e48 100644
--- a/bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_viewSelectPaymentTransactionLineListDialog.xml
+++ b/bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_viewSelectPaymentTransactionLineListDialog.xml
@@ -102,7 +102,7 @@
                         <string>your_start_date_range_min</string>
                         <string>your_start_date_range_max</string>
                         <string>your_sign</string>
-                        <string>your_mode</string>
+                        <string>your_select_mode</string>
                       </list>
                     </value>
                 </item>
diff --git a/bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_viewSelectPaymentTransactionLineListDialog/your_mode.xml b/bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_viewSelectPaymentTransactionLineListDialog/your_select_mode.xml
similarity index 99%
rename from bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_viewSelectPaymentTransactionLineListDialog/your_mode.xml
rename to bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_viewSelectPaymentTransactionLineListDialog/your_select_mode.xml
index f7bc9d5bb7..0e149628f7 100644
--- a/bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_viewSelectPaymentTransactionLineListDialog/your_mode.xml
+++ b/bt5/erp5_payment_mean/SkinTemplateItem/portal_skins/erp5_payment_mean/PaymentTransactionGroup_viewSelectPaymentTransactionLineListDialog/your_select_mode.xml
@@ -8,7 +8,7 @@
       <dictionary>
         <item>
             <key> <string>id</string> </key>
-            <value> <string>your_mode</string> </value>
+            <value> <string>your_select_mode</string> </value>
         </item>
         <item>
             <key> <string>message_values</string> </key>
diff --git a/bt5/erp5_payment_mean/TestTemplateItem/portal_components/test.erp5.testPaymentTransactionGroup.py b/bt5/erp5_payment_mean/TestTemplateItem/portal_components/test.erp5.testPaymentTransactionGroup.py
index a2a87295b6..679784f25f 100644
--- a/bt5/erp5_payment_mean/TestTemplateItem/portal_components/test.erp5.testPaymentTransactionGroup.py
+++ b/bt5/erp5_payment_mean/TestTemplateItem/portal_components/test.erp5.testPaymentTransactionGroup.py
@@ -250,7 +250,7 @@ class TestPaymentTransactionGroupPaymentSelection(AccountingTestCase):
         start_date_range_min=None,
         start_date_range_max=None,
         sign='incoming',
-        mode='stopped_or_delivered',
+        select_mode='stopped_or_delivered',
     )
     self.assertEqual(
         sorted([line.getObject().getRelativeUrl() for line in line_list]),
@@ -265,7 +265,7 @@ class TestPaymentTransactionGroupPaymentSelection(AccountingTestCase):
         start_date_range_min=None,
         start_date_range_max=None,
         sign='incoming',
-        mode='stopped_or_delivered',
+        select_mode='stopped_or_delivered',
     )
     self.assertEqual(
         sorted([line.getObject().getRelativeUrl() for line in line_list]),
@@ -314,7 +314,7 @@ class TestPaymentTransactionGroupPaymentSelection(AccountingTestCase):
         price_currency_value=self.portal.currency_module.euro,
         stop_date=DateTime(2014, 1, 31),)
     self.tic()
-    ptg.PaymentTransactionGroup_selectPaymentTransactionLineList(mode='stopped_or_delivered')
+    ptg.PaymentTransactionGroup_selectPaymentTransactionLineList(select_mode='stopped_or_delivered')
     self.tic()
     self.assertEqual(
         payment.bank.getAggregateValueList(),
diff --git a/bt5/erp5_payment_mean_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_payment_mean_zuite/testPaymentTransactionGroupSelectPaymentsFastInput.zpt b/bt5/erp5_payment_mean_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_payment_mean_zuite/testPaymentTransactionGroupSelectPaymentsFastInput.zpt
index 3102f11285..649af99f9a 100644
--- a/bt5/erp5_payment_mean_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_payment_mean_zuite/testPaymentTransactionGroupSelectPaymentsFastInput.zpt
+++ b/bt5/erp5_payment_mean_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_payment_mean_zuite/testPaymentTransactionGroupSelectPaymentsFastInput.zpt
@@ -19,6 +19,10 @@
   <td>field_your_sign</td>
   <td>Outgoing</td>
 </tr>
+<!-- there's an empty listbox by default (and not a "Invalid Search Criteria-Reset" error) -->
+<tal:block tal:define="pagination_configuration python: {'header': '(0)', 'footer': 'No records'}">
+  <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/check_listbox_pagination_text" />
+</tal:block>
 
 <!-- update dialog -->
 <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/update_dialog" />
diff --git a/bt5/erp5_payment_mean_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_payment_mean_zuite/testPaymentTransactionGroupSelectPlannedOrConfirmedPaymentsFastInput.zpt b/bt5/erp5_payment_mean_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_payment_mean_zuite/testPaymentTransactionGroupSelectPlannedOrConfirmedPaymentsFastInput.zpt
index f02848757c..a76d2a5f5f 100644
--- a/bt5/erp5_payment_mean_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_payment_mean_zuite/testPaymentTransactionGroupSelectPlannedOrConfirmedPaymentsFastInput.zpt
+++ b/bt5/erp5_payment_mean_renderjs_ui_test/PathTemplateItem/portal_tests/renderjs_ui_payment_mean_zuite/testPaymentTransactionGroupSelectPlannedOrConfirmedPaymentsFastInput.zpt
@@ -17,14 +17,14 @@
 
 <tr>
   <td>assertSelected</td>
-  <td>field_your_mode</td>
+  <td>field_your_select_mode</td>
   <td>Select already Posted to General Ledger or Closed Payments</td>
 </tr>
 
 <!-- update dialog -->
 <tr>
   <td>select</td>
-  <td>field_your_mode</td>
+  <td>field_your_select_mode</td>
   <td>Select Planned or Confirmed Payments and Post them to General Ledger</td>
 </tr>
 <tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/update_dialog" />
diff --git a/bt5/erp5_payment_mean_ui_test/PathTemplateItem/portal_tests/payment_mean_zuite/testPaymentTransactionGroupSelectPlannedOrConfirmedPaymentsFastInput.zpt b/bt5/erp5_payment_mean_ui_test/PathTemplateItem/portal_tests/payment_mean_zuite/testPaymentTransactionGroupSelectPlannedOrConfirmedPaymentsFastInput.zpt
index 2fc12010e5..59aaa9f3a6 100644
--- a/bt5/erp5_payment_mean_ui_test/PathTemplateItem/portal_tests/payment_mean_zuite/testPaymentTransactionGroupSelectPlannedOrConfirmedPaymentsFastInput.zpt
+++ b/bt5/erp5_payment_mean_ui_test/PathTemplateItem/portal_tests/payment_mean_zuite/testPaymentTransactionGroupSelectPlannedOrConfirmedPaymentsFastInput.zpt
@@ -16,14 +16,14 @@
 
 <tr>
   <td>assertSelected</td>
-  <td>field_your_mode</td>
+  <td>field_your_select_mode</td>
   <td>Select already Posted to General Ledger or Closed Payments</td>
 </tr>
 
 <!-- update dialog -->
 <tr>
   <td>select</td>
-  <td>field_your_mode</td>
+  <td>field_your_select_mode</td>
   <td>Select Planned or Confirmed Payments and Post them to General Ledger</td>
 </tr>
 
-- 
2.30.9