Commit 72969302 authored by Arnaud Fontaine's avatar Arnaud Fontaine

erp5_accounting_l10n_fr: Allow to pass additional Catalog parameters to select...

erp5_accounting_l10n_fr: Allow to pass additional Catalog parameters to select Accounting Transaction to FEC export.

Introduced for customer Unit Tests to be able to FEC export only ATs of the
current Unit Test FEC based on 'title'.
parent 9c8400c8
......@@ -27,7 +27,8 @@ context.activate().AccountingTransactionModule_viewFrenchAccountingTransactionFi
ledger,
user_name=user_name,
tag=tag,
aggregate_tag=aggregate_tag)
aggregate_tag=aggregate_tag,
search_kw=search_kw)
return context.Base_redirect(form_id, keep_items=dict(
portal_status_message=translateString("Report Started")))
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>section_category, section_category_strict, at_date, simulation_state, from_date=None, group_by=\'portal_type\', ledger=None, form_id=None, **kw</string> </value>
<value> <string>section_category, section_category_strict, at_date, simulation_state, from_date=None, group_by=\'portal_type\', ledger=None, form_id=None, search_kw=None, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -18,21 +18,23 @@ if ledger is not None:
elif group_by in ('ledger', 'portal_type_ledger'):
raise ValueError("At least one Ledger is needed for group_by=%r" % group_by)
if search_kw is None:
search_kw = {}
def _groupedJournalTupleDict():
portal_type_list = portal.getPortalAccountingTransactionTypeList()
default_search_kw = {
'simulation_state': simulation_state,
'accounting_transaction.section_uid': section_uid_list,
'operation_date': {'query': (from_date, at_date), 'range': 'minngt' },
}
search_kw['simulation_state'] = simulation_state
search_kw['accounting_transaction.section_uid'] = section_uid_list
search_kw['operation_date'] = {'query': (from_date, at_date), 'range': 'minngt' }
journal_tuple_list = []
if group_by == 'ledger':
default_search_kw['portal_type'] = portal_type_list
search_kw['portal_type'] = portal_type_list
for ledger_obj in ledger_obj_list:
journal_code = journal_lib = ledger_obj.getReference(ledger_obj.getId())
ledger_search_kw = default_search_kw.copy()
ledger_search_kw = search_kw.copy()
ledger_search_kw['default_ledger_uid'] = ledger_obj.getUid()
journal_tuple_list.append((journal_code, journal_lib, ledger_search_kw))
......@@ -45,7 +47,7 @@ def _groupedJournalTupleDict():
journal_code = "%s: %s" % (portal_type_obj.getCompactTranslatedTitle(), ledger_reference)
journal_lib = "%s: %s" % (portal_type_obj.getTranslatedTitle(), ledger_reference)
portal_type_ledger_search_kw = default_search_kw.copy()
portal_type_ledger_search_kw = search_kw.copy()
portal_type_ledger_search_kw['default_ledger_uid'] = ledger_obj.getUid()
portal_type_ledger_search_kw['portal_type'] = portal_type
......@@ -54,14 +56,14 @@ def _groupedJournalTupleDict():
# group_by == 'portal_type' (Default)
else:
if ledger_obj_list:
default_search_kw['default_ledger_uid'] = [ ledger_obj.getUid() for ledger_obj in ledger_obj_list ]
search_kw['default_ledger_uid'] = [ ledger_obj.getUid() for ledger_obj in ledger_obj_list ]
for portal_type in portal_type_list:
portal_type_obj = portal.portal_types[portal_type]
journal_code = portal_type_obj.getCompactTranslatedTitle()
journal_lib = portal_type_obj.getTranslatedTitle()
portal_type_search_kw = default_search_kw.copy()
portal_type_search_kw = search_kw.copy()
portal_type_search_kw['portal_type'] = portal_type
journal_tuple_list.append((journal_code, journal_lib, portal_type_search_kw))
......@@ -77,7 +79,7 @@ if tag is None:
if aggregate_tag is None:
aggregate_tag = '%s:aggregate' % tag
for journal_code, journal_lib, search_kw in _groupedJournalTupleDict():
for journal_code, journal_lib, journal_search_kw in _groupedJournalTupleDict():
# This script is executed with Proxy Role, required to create 'Active Process'
this_journal_active_process = context.AccountingTransactionModule_createActiveProcessForFrenchAccountingTransactionFile()
......@@ -85,7 +87,7 @@ for journal_code, journal_lib, search_kw in _groupedJournalTupleDict():
method_id='AccountingTransaction_postFECResult',
method_kw=dict(section_uid_list=section_uid_list, active_process=this_journal_active_process.getRelativeUrl()),
activate_kw=dict(tag=tag, priority=priority),
**search_kw)
**journal_search_kw)
context.activate(
tag=aggregate_tag,
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>section_category, section_category_strict, from_date, at_date, group_by, simulation_state, ledger, user_name=None, tag=None, aggregate_tag=None, **kw</string> </value>
<value> <string>section_category, section_category_strict, from_date, at_date, group_by, simulation_state, ledger, user_name=None, tag=None, aggregate_tag=None, search_kw=None, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
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