Commit f5c68f71 authored by Jérome Perrin's avatar Jérome Perrin Committed by Aurel

payment_mean: allow searching by supplier in Select Payment dialog

This uses a listbox search column, which is not yet supported in ERP5JS,
so for now the feature is only available in erp5_xhtml_style.
parent 7fb1467d
...@@ -36,6 +36,9 @@ if start_date_range_max: ...@@ -36,6 +36,9 @@ if start_date_range_max:
if start_date_range_min: if start_date_range_min:
search_kw['from_date'] = start_date_range_min search_kw['from_date'] = start_date_range_min
if Movement_getMirrorSectionTitle:
search_kw['stock_mirror_section_title'] = Movement_getMirrorSectionTitle
if sign in ('outgoing', 'out'): if sign in ('outgoing', 'out'):
search_kw['omit_asset_increase'] = True search_kw['omit_asset_increase'] = True
elif sign in ('incoming', 'in'): elif sign in ('incoming', 'in'):
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>select_limit=None, start_date_range_min=None, start_date_range_max=None, sign=None, mode=None, **kw</string> </value> <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>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -13,6 +13,7 @@ context.activate(tag=tag).PaymentTransactionGroup_selectPaymentTransactionLineLi ...@@ -13,6 +13,7 @@ context.activate(tag=tag).PaymentTransactionGroup_selectPaymentTransactionLineLi
start_date_range_max=start_date_range_max, start_date_range_max=start_date_range_max,
sign=sign, sign=sign,
mode=mode, mode=mode,
Movement_getMirrorSectionTitle=listbox_Movement_getMirrorSectionTitle,
tag=tag) tag=tag)
return context.Base_redirect(form_id, return context.Base_redirect(form_id,
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>form_id=\'view\', select_limit=None, start_date_range_min=None, start_date_range_max=None, sign=None, mode=None, **kw</string> </value> <value> <string>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>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -11,7 +11,8 @@ payment_relative_url_list = [brain.relative_url for brain ...@@ -11,7 +11,8 @@ payment_relative_url_list = [brain.relative_url for brain
start_date_range_min=start_date_range_min, start_date_range_min=start_date_range_min,
start_date_range_max=start_date_range_max, start_date_range_max=start_date_range_max,
sign=sign, sign=sign,
mode=mode,)] mode=mode,
Movement_getMirrorSectionTitle=Movement_getMirrorSectionTitle,)]
if mode == 'stopped_or_delivered': if mode == 'stopped_or_delivered':
method_id = 'AccountingTransactionLine_addPaymentTransactionGroup' method_id = 'AccountingTransactionLine_addPaymentTransactionGroup'
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>select_limit=None, start_date_range_min=None, start_date_range_max=None, sign=None, mode=None, tag=\'\'</string> </value> <value> <string>select_limit=None, start_date_range_min=None, start_date_range_max=None, sign=None, mode=None, Movement_getMirrorSectionTitle=None, tag=\'\'</string> </value>
</item> </item>
<item> <item>
<key> <string>_proxy_roles</string> </key> <key> <string>_proxy_roles</string> </key>
......
...@@ -580,12 +580,17 @@ ...@@ -580,12 +580,17 @@
</item> </item>
<item> <item>
<key> <string>search</string> </key> <key> <string>search</string> </key>
<value> <int>0</int> </value> <value> <int>1</int> </value>
</item> </item>
<item> <item>
<key> <string>search_columns</string> </key> <key> <string>search_columns</string> </key>
<value> <value>
<list/> <list>
<tuple>
<string>Movement_getMirrorSectionTitle</string>
<string>Third Party</string>
</tuple>
</list>
</value> </value>
</item> </item>
<item> <item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testPaymentTransactionGroupSelectPaymentsFastInputSearchByThirdPartyName</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title tal:content="template/title_or_id"></title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3" tal:content="template/title_or_id"></td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_viewCommonTemplatePaymentMeanUiTest/macros/init" />
<tal:block metal:use-macro="here/Zuite_viewCommonTemplatePaymentMeanUiTest/macros/prepare_data" />
<tal:block metal:use-macro="here/Zuite_viewCommonTemplatePaymentMeanUiTest/macros/view_fast_input" />
<!-- update dialog -->
<tr>
<td>clickAndWait</td>
<td>dialog_update_button</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>//span[@class="listbox-current-page-total-number"]</td>
<td>2 records</td>
</tr>
<!-- search -->
<tr>
<td>type</td>
<td>//table[contains(@class, "listbox")]//input[@name="listbox_Movement_getMirrorSectionTitle"]</td>
<td>erp5_payment_mean_ui_test_first_supplier</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>dialog_update_button</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>//span[@class="listbox-current-page-total-number"]</td>
<td>1 records</td>
</tr>
<!-- select -->
<tr>
<td>clickAndWait</td>
<td>dialog_submit_button</td>
<td></td>
</tr>
<tr>
<td>assertPortalStatusMessage</td>
<td>Payment selection in progress.</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/wait_for_activities" />
<tr>
<td>open</td>
<td>${base_url}/payment_transaction_group_module/erp5_payment_mean_ui_test_payment_transaction_group</td>
<td></td>
</tr>
<tr>
<td>assertText</td>
<td>//span[@class="listbox-current-page-total-number"]</td>
<td>1 records</td>
</tr>
<tr>
<td>assertText</td>
<td>//table[contains(@class, "listbox")]//tr[1]/td[5]</td>
<td>erp5_payment_mean_ui_test_first_supplier</td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
...@@ -43,21 +43,27 @@ payment_mean = portal.payment_transaction_group_module.newContent( ...@@ -43,21 +43,27 @@ payment_mean = portal.payment_transaction_group_module.newContent(
) )
payment_mean.open() payment_mean.open()
for id_, date, resource_value, payment_mode_value, quantity, state, consistent in ( first_supplier = portal.organisation_module.newContent(id="erp5_payment_mean_ui_test_first_supplier")
('erp5_payment_mean_ui_test_incoming_payment', DateTime('2019/10/20'), portal.currency_module.euro, portal.portal_categories.payment_mode.cash, -100, 'stopped', True), first_supplier.validate()
('erp5_payment_mean_ui_test_outgoing_payment', DateTime('2019/10/20'), portal.currency_module.euro, portal.portal_categories.payment_mode.cash, 100, 'stopped', True), second_supplier = portal.organisation_module.newContent(id="erp5_payment_mean_ui_test_second_supplier")
('erp5_payment_mean_ui_test_second_outgoing_payment', DateTime('2019/10/21'), portal.currency_module.euro, portal.portal_categories.payment_mode.cash, 100, 'stopped', True), second_supplier.validate()
('erp5_payment_mean_ui_test_planned_outgoing_payment', DateTime('2019/10/20'), portal.currency_module.euro, portal.portal_categories.payment_mode.cash, 100, 'planned', True),
('erp5_payment_mean_ui_test_confirmed_outgoing_payment', DateTime('2019/10/20'), portal.currency_module.euro, portal.portal_categories.payment_mode.cash, 100, 'confirmed', True), for id_, supplier, date, resource_value, payment_mode_value, quantity, state, consistent in (
('erp5_payment_mean_ui_test_confirmed_not_consistent_outgoing_payment', DateTime('2019/10/20'), portal.currency_module.euro, portal.portal_categories.payment_mode.cash, 100, 'confirmed', False), ('erp5_payment_mean_ui_test_incoming_payment', first_supplier, DateTime('2019/10/20'), portal.currency_module.euro, portal.portal_categories.payment_mode.cash, -100, 'stopped', True),
('erp5_payment_mean_ui_test_wrong_payment_mode_outgoing_payment', DateTime('2019/10/20'), portal.currency_module.euro, portal.portal_categories.payment_mode.check, 100, 'stopped', True), ('erp5_payment_mean_ui_test_outgoing_payment', first_supplier, DateTime('2019/10/20'), portal.currency_module.euro, portal.portal_categories.payment_mode.cash, 100, 'stopped', True),
('erp5_payment_mean_ui_test_wrong_currency_outgoing_payment', DateTime('2019/10/20'), portal.currency_module.yen, portal.portal_categories.payment_mode.cash, 100, 'stopped', True), ('erp5_payment_mean_ui_test_second_outgoing_payment', second_supplier, DateTime('2019/10/21'), portal.currency_module.euro, portal.portal_categories.payment_mode.cash, 100, 'stopped', True),
('erp5_payment_mean_ui_test_planned_outgoing_payment', first_supplier, DateTime('2019/10/20'), portal.currency_module.euro, portal.portal_categories.payment_mode.cash, 100, 'planned', True),
('erp5_payment_mean_ui_test_confirmed_outgoing_payment', first_supplier, DateTime('2019/10/20'), portal.currency_module.euro, portal.portal_categories.payment_mode.cash, 100, 'confirmed', True),
('erp5_payment_mean_ui_test_confirmed_not_consistent_outgoing_payment', first_supplier, DateTime('2019/10/20'), portal.currency_module.euro, portal.portal_categories.payment_mode.cash, 100, 'confirmed', False),
('erp5_payment_mean_ui_test_wrong_payment_mode_outgoing_payment', first_supplier, DateTime('2019/10/20'), portal.currency_module.euro, portal.portal_categories.payment_mode.check, 100, 'stopped', True),
('erp5_payment_mean_ui_test_wrong_currency_outgoing_payment', first_supplier, DateTime('2019/10/20'), portal.currency_module.yen, portal.portal_categories.payment_mode.cash, 100, 'stopped', True),
): ):
payment = portal.accounting_module.newContent( payment = portal.accounting_module.newContent(
portal_type='Payment Transaction', portal_type='Payment Transaction',
id=id_, id=id_,
source_section_value=organisation, source_section_value=organisation,
source_payment_value=bank_account, source_payment_value=bank_account,
destination_section_value=supplier,
start_date=date, start_date=date,
resource_value=resource_value, resource_value=resource_value,
payment_mode_value=payment_mode_value, payment_mode_value=payment_mode_value,
......
portal = context.getPortalObject() portal = context.getPortalObject()
for portal_type, document_id_list in ( for portal_type, document_id_list in (
('Organisation', ('erp5_payment_mean_ui_test_organisation', )), ('Organisation', (
'erp5_payment_mean_ui_test_organisation',
'erp5_payment_mean_ui_test_first_supplier',
'erp5_payment_mean_ui_test_second_supplier',),),
('Payment Transaction Group', ('erp5_payment_mean_ui_test_payment_transaction_group',),), ('Payment Transaction Group', ('erp5_payment_mean_ui_test_payment_transaction_group',),),
('Payment Transaction', ( ('Payment Transaction', (
'erp5_payment_mean_ui_test_incoming_payment', 'erp5_payment_mean_ui_test_incoming_payment',
...@@ -11,8 +14,7 @@ for portal_type, document_id_list in ( ...@@ -11,8 +14,7 @@ for portal_type, document_id_list in (
'erp5_payment_mean_ui_test_confirmed_not_consistent_outgoing_payment', 'erp5_payment_mean_ui_test_confirmed_not_consistent_outgoing_payment',
'erp5_payment_mean_ui_test_second_outgoing_payment', 'erp5_payment_mean_ui_test_second_outgoing_payment',
'erp5_payment_mean_ui_test_wrong_payment_mode_outgoing_payment', 'erp5_payment_mean_ui_test_wrong_payment_mode_outgoing_payment',
'erp5_payment_mean_ui_test_wrong_currency_outgoing_payment', 'erp5_payment_mean_ui_test_wrong_currency_outgoing_payment',),),
),),
): ):
module = portal.getDefaultModule(portal_type) module = portal.getDefaultModule(portal_type)
for document_id in document_id_list: for document_id in document_id_list:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment