Commit 70a8e561 authored by Jérome Perrin's avatar Jérome Perrin

Merge erp5_accounting_alternate_catalog in erp5_accounting

Also add support for own section title and count method.
Update configurator accordingly
parent f1b7b62c
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="SQL" module="Products.ZSQLMethods.SQL"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>arguments_src</string> </key>
<value> <string>table_0</string> </value>
</item>
<item>
<key> <string>connection_id</string> </key>
<value> <string>erp5_sql_connection</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>z_related_accounting_transaction_section</string> </value>
</item>
<item>
<key> <string>src</string> </key>
<value> <string encoding="cdata"><![CDATA[
accounting_transaction.section_uid = <dtml-var table_0>.uid\n
]]></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<key_list>
<key>accounting_transaction_line_node_uid | stock/node_uid/z_related_accounting_transaction_stock_line</key>
<key>accounting_transaction_line_total_price | stock/total_price/z_related_accounting_transaction_stock_line</key>
<key>accounting_transaction_mirror_section_title | catalog/title/z_related_accounting_transaction_mirror_section</key>
<key>accounting_transaction_payment_title | catalog/title/z_related_accounting_transaction_payment</key>
<key>accounting_transaction_project_title | catalog/title/z_related_accounting_transaction_project</key>
<key>accounting_transaction_section_title | catalog/title/z_related_accounting_transaction_section</key>
<key>preferred_gap_id | category,catalog/id/z_related_preferred_gap</key>
<key>preferred_gap_strict_membership_id | category,catalog/id/z_related_strict_membership_preferred_gap</key>
</key_list>
\ No newline at end of file
......@@ -50,35 +50,13 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>if kw.get(\'stat\', 0) :\n
del kw[\'stat\']\n
\n
kw[\'omit_input\'] = 0\n
kw[\'omit_output\'] = 0\n
\n
\n
kw[\'source_section_where_expression\'] = \'\'\n
kw[\'destination_section_where_expression\'] = \'\'\n
\n
if (kw.get(\'operation_date\') or {}).get(\'query\'):\n
buildSQLQuery = context.portal_catalog.buildSQLQuery\n
kw[\'source_section_where_expression\'] = buildSQLQuery(\n
**{\'delivery.start_date\': kw[\'operation_date\']})[\'where_expression\']\n
kw[\'destination_section_where_expression\'] = buildSQLQuery(\n
**{\'delivery.stop_date\': kw[\'operation_date\']})[\'where_expression\']\n
del kw[\'operation_date\']\n
\n
\n
return context.AccountingTransactionModule_zGetAccountingTransactionList( selection=None,\n
selection_params=kw,\n
stat=0,\n
count=1,\n
**kw )\n
<value> <string>params[\'stat\'] = 1\n
return context.AccountingTransactionModule_getAccountingTransactionList(**params)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>brain=None, selection=None, **kw</string> </value>
<value> <string>**params</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -50,63 +50,125 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
# XXX workarounds for DTML limitation\n
# Because DTML cannot do <dtml-if node or resource or...>\n
# If Python is used, it does not check the existence of a variable automatically\n
<value> <string>portal = context.getPortalObject()\n
getUid = portal.portal_categories.getCategoryUid\n
\n
if \'node\' not in params:\n
params[\'node\'] = []\n
if \'resource\' not in params:\n
params[\'resource\'] = []\n
if \'from_date\' not in params:\n
params[\'from_date\'] = \'\'\n
if \'to_date\' not in params:\n
params[\'to_date\'] = \'\'\n
if \'section_category\' not in params:\n
params[\'section_category\'] = \'\'\n
section_category = params.pop(\'section_category\', None)\n
section_category_strict = params.pop(\'section_category_strict\', None)\n
params[\'accounting_transaction.section_uid\'] = \'\'\n
if section_category:\n
params[\'accounting_transaction.section_uid\'] = context.Base_getSectionUidListForSectionCategory(\n
section_category, strict_membership=section_category_strict)\n
\n
if params.get(\'stat\', 0):\n
params[\'stat\'] = 0\n
if params.get(\'count\', 0):\n
params[\'count\'] = 0\n
params[\'omit_input\'] = 0\n
params[\'omit_output\'] = 0\n
# rewrite payment_mode_relative_url to uid\n
payment_mode_relative_url = params.pop(\'payment_mode_relative_url\', None)\n
if payment_mode_relative_url:\n
params[\'default_payment_mode_uid\'] = \\\n
portal.portal_categories.payment_mode.getCategoryUid(payment_mode_relative_url)\n
\n
# rewrite currency to uid\n
resource = params.pop(\'resource\', None)\n
if resource:\n
params[\'accounting_transaction.resource_uid\'] = getUid(resource)\n
\n
params[\'source_section_where_expression\'] = \'\'\n
params[\'destination_section_where_expression\'] = \'\'\n
\n
if (params.get(\'operation_date\') or {}).get(\'query\'):\n
buildSQLQuery = context.portal_catalog.buildSQLQuery\n
params[\'source_section_where_expression\'] = buildSQLQuery(\n
**{\'delivery.start_date\': params[\'operation_date\']})[\'where_expression\']\n
params[\'destination_section_where_expression\'] = buildSQLQuery(\n
**{\'delivery.stop_date\': params[\'operation_date\']})[\'where_expression\']\n
del params[\'operation_date\']\n
# XXX wrong name compat\n
# TODO: make it better on search dialog\n
node_list = params.pop(\'node\', None)\n
if node_list:\n
params[\'accounting_transaction_line_node_uid\'] = [\n
getUid(node) for node in node_list]\n
\n
entity = params.pop(\'entity\', None)\n
if entity:\n
params[\'accounting_transaction.mirror_section_uid\'] = getUid(entity)\n
\n
# this method can be used to build another complex query, for example\n
# as a catalog.parent_uid filter with SimulationTool.getMovementList.\n
# In this example, you can use side independant inventory API with \n
# accounting module selection. see erp5_accounting_l10n_fr_m9 for an example.\n
# ... XXX no this is deprecated\n
src__ = context.REQUEST.other.get(\'src__\', 0)\n
search_result_keys = context.REQUEST.other.get(\'search_result_keys\', None)\n
if not params.get(\'operation_date\'):\n
params.pop(\'from_date\', None)\n
params.pop(\'to_date\', None)\n
if from_date or to_date:\n
if from_date:\n
if to_date:\n
params[\'operation_date\'] = dict(\n
query=(from_date, to_date),\n
range=\'minngt\')\n
else:\n
params[\'operation_date\'] = dict(\n
query=(from_date, ),\n
range=\'min\')\n
else:\n
params[\'operation_date\'] = dict(\n
query=(to_date, ),\n
range=\'ngt\')\n
\n
amount = params.pop(\'amount\', \'\')\n
if amount not in (None, \'\'):\n
params[\'accounting_transaction_line_total_price\'] = amount\n
else:\n
amount_range_min = params.pop(\'amount_range_min\', None)\n
amount_range_max = params.pop(\'amount_range_max\', None)\n
if amount_range_min or amount_range_max:\n
if amount_range_min:\n
if amount_range_max:\n
params[\'accounting_transaction_line_total_price\'] = dict(\n
query=(amount_range_min, amount_range_max),\n
range=\'minmax\')\n
else:\n
params[\'accounting_transaction_line_total_price\'] = dict(\n
query=(amount_range_min, ),\n
range=\'min\')\n
else:\n
params[\'accounting_transaction_line_total_price\'] = dict(\n
query=(amount_range_max, ),\n
range=\'max\')\n
\n
return context.AccountingTransactionModule_zGetAccountingTransactionList( \n
selection_params=params,\n
src__=src__,\n
search_result_keys=search_result_keys,\n
**params)\n
]]></string> </value>
\n
creation_date_range_min = params.pop(\'creation_date_range_min\', None)\n
creation_date_range_max = params.pop(\'creation_date_range_max\', None)\n
if creation_date_range_min or creation_date_range_max:\n
if creation_date_range_min:\n
if creation_date_range_max:\n
params[\'creation_date\'] = dict(\n
query=(creation_date_range_min, creation_date_range_max),\n
range=\'minmax\')\n
else:\n
params[\'creation_date\'] = dict(\n
query=(creation_date_range_min, ),\n
range=\'min\')\n
else:\n
params[\'creation_date\'] = dict(\n
query=(creation_date_range_max, ),\n
range=\'max\')\n
\n
if stat:\n
return context.countFolder(**params)\n
\n
select_dict = params.get(\'select_dict\') or dict()\n
select_dict.update(dict(total_debit=None,\n
total_credit=None,\n
reference=None,\n
specific_reference=None,\n
project_uid=None,\n
payment_uid=None,\n
mirror_section_uid=None,\n
operation_date=None))\n
\n
params[\'select_dict\'] = select_dict\n
\n
# We group by uid to really filter duplicated lines, but this makes generated\n
# query much slower, and in reality duplicated lines are transactions for which\n
# both source section and destination section match the criterions. This can be\n
# because there are no criterion on section_uid or because both sections are members\n
# of the selected group. In the later it can be accepted as not a problem.\n
if not params.get(\'accounting_transaction.section_uid\'):\n
params.setdefault(\'group_by\', (\'uid\',))\n
\n
return context.searchFolder(**params)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**params</string> </value>
<value> <string>from_date=None, to_date=None, stat=False, **params</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -70,14 +70,14 @@
<key> <string>hidden</string> </key>
<value>
<list>
<string>listbox_credit</string>
<string>listbox_debit</string>
<string>listbox_delivery_mirror_section_title</string>
<string>listbox_operation_date</string>
<string>listbox_delivery_mirror_section_title_with_link</string>
<string>listbox_total_net_price</string>
<string>listbox_total_price</string>
<string>listbox_delivery_own_section_title</string>
<string>listbox_accounting_transaction_section_title</string>
<string>listbox_accounting_transaction_mirror_section_title</string>
<string>listbox_accounting_transaction_payment_title</string>
<string>listbox_accounting_transaction_project_title</string>
<string>listbox_operation_date</string>
<string>listbox_total_credit</string>
<string>listbox_total_debit</string>
</list>
</value>
</item>
......
......@@ -8,7 +8,7 @@
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>listbox_delivery_own_section_title</string> </value>
<value> <string>listbox_accounting_transaction_section_title</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
......
......@@ -486,7 +486,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python:(getattr(cell, \'section_mark\', \'\') ==\'source\' and cell.getStartDate()) or cell.getStopDate()</string> </value>
<value> <string>python: cell.operation_date and cell.operation_date.toZone(cell.getObject().getStopDate().timezone())</string> </value>
</item>
</dictionary>
</pickle>
......
1526
\ No newline at end of file
1527
\ No newline at end of file
erp5_mysql_innodb/z0_drop_accounting_transaction
erp5_mysql_innodb/z0_uncatalog_accounting_transaction
erp5_mysql_innodb/z_catalog_accounting_transaction_list
erp5_mysql_innodb/z_create_accounting_transaction
erp5_mysql_innodb/z_related_accounting_transaction_mirror_section
erp5_mysql_innodb/z_related_accounting_transaction_payment
erp5_mysql_innodb/z_related_accounting_transaction_project
erp5_mysql_innodb/z_related_accounting_transaction_section
erp5_mysql_innodb/z_related_accounting_transaction_stock_line
erp5_mysql_innodb/z_related_preferred_gap
erp5_mysql_innodb/z_related_strict_membership_preferred_gap
\ No newline at end of file
preferred_gap_id | category,catalog/id/z_related_preferred_gap
preferred_gap_strict_membership_id | category,catalog/id/z_related_strict_membership_preferred_gap
\ No newline at end of file
preferred_gap_strict_membership_id | category,catalog/id/z_related_strict_membership_preferred_gap
accounting_transaction_mirror_section_title | catalog/title/z_related_accounting_transaction_mirror_section
accounting_transaction_section_title | catalog/title/z_related_accounting_transaction_section
accounting_transaction_project_title | catalog/title/z_related_accounting_transaction_project
accounting_transaction_payment_title | catalog/title/z_related_accounting_transaction_payment
accounting_transaction_line_node_uid | stock/node_uid/z_related_accounting_transaction_stock_line
accounting_transaction_line_total_price | stock/total_price/z_related_accounting_transaction_stock_line
\ No newline at end of file
<key_list>
<key>accounting_transaction_line_node_uid | stock/node_uid/z_related_accounting_transaction_stock_line</key>
<key>accounting_transaction_line_total_price | stock/total_price/z_related_accounting_transaction_stock_line</key>
<key>accounting_transaction_mirror_section_title | catalog/title/z_related_accounting_transaction_mirror_section</key>
<key>accounting_transaction_payment_title | catalog/title/z_related_accounting_transaction_payment</key>
<key>accounting_transaction_project_title | catalog/title/z_related_accounting_transaction_project</key>
</key_list>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Folder" module="OFS.Folder"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>business_template_skin_layer_priority</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>float</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>business_template_skin_layer_priority</string> </key>
<value> <float>10.0</float> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>erp5_accounting_alternate_catalog</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<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_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<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>_body</string> </key>
<value> <string>portal = context.getPortalObject()\n
getUid = portal.portal_categories.getCategoryUid\n
\n
section_category = params.pop(\'section_category\', None)\n
section_category_strict = params.pop(\'section_category_strict\', None)\n
params[\'accounting_transaction.section_uid\'] = \'\'\n
if section_category:\n
params[\'accounting_transaction.section_uid\'] = context.Base_getSectionUidListForSectionCategory(\n
section_category, strict_membership=section_category_strict)\n
\n
# rewrite payment_mode_relative_url to uid\n
payment_mode_relative_url = params.pop(\'payment_mode_relative_url\', None)\n
if payment_mode_relative_url:\n
params[\'default_payment_mode_uid\'] = \\\n
portal.portal_categories.payment_mode.getCategoryUid(payment_mode_relative_url)\n
\n
# rewrite currency to uid\n
resource = params.pop(\'resource\', None)\n
if resource:\n
params[\'accounting_transaction.resource_uid\'] = getUid(resource)\n
\n
\n
# XXX wrong name compat\n
# TODO: make it better on search dialog\n
node_list = params.pop(\'node\', None)\n
if node_list:\n
params[\'accounting_transaction_line_node_uid\'] = [\n
getUid(node) for node in node_list]\n
\n
entity = params.pop(\'entity\', None)\n
if entity:\n
params[\'accounting_transaction.mirror_section_uid\'] = getUid(entity)\n
\n
if not params.get(\'operation_date\'):\n
params.pop(\'from_date\', None)\n
params.pop(\'to_date\', None)\n
if from_date or to_date:\n
if from_date:\n
if to_date:\n
params[\'operation_date\'] = dict(\n
query=(from_date, to_date),\n
range=\'minngt\')\n
else:\n
params[\'operation_date\'] = dict(\n
query=(from_date, ),\n
range=\'min\')\n
else:\n
params[\'operation_date\'] = dict(\n
query=(to_date, ),\n
range=\'ngt\')\n
\n
amount = params.pop(\'amount\', \'\')\n
if amount not in (None, \'\'):\n
params[\'accounting_transaction_line_total_price\'] = amount\n
else:\n
amount_range_min = params.pop(\'amount_range_min\', None)\n
amount_range_max = params.pop(\'amount_range_max\', None)\n
if amount_range_min or amount_range_max:\n
if amount_range_min:\n
if amount_range_max:\n
params[\'accounting_transaction_line_total_price\'] = dict(\n
query=(amount_range_min, amount_range_max),\n
range=\'minmax\')\n
else:\n
params[\'accounting_transaction_line_total_price\'] = dict(\n
query=(amount_range_min, ),\n
range=\'min\')\n
else:\n
params[\'accounting_transaction_line_total_price\'] = dict(\n
query=(amount_range_max, ),\n
range=\'max\')\n
\n
\n
creation_date_range_min = params.pop(\'creation_date_range_min\', None)\n
creation_date_range_max = params.pop(\'creation_date_range_max\', None)\n
if creation_date_range_min or creation_date_range_max:\n
if creation_date_range_min:\n
if creation_date_range_max:\n
params[\'creation_date\'] = dict(\n
query=(creation_date_range_min, creation_date_range_max),\n
range=\'minmax\')\n
else:\n
params[\'creation_date\'] = dict(\n
query=(creation_date_range_min, ),\n
range=\'min\')\n
else:\n
params[\'creation_date\'] = dict(\n
query=(creation_date_range_max, ),\n
range=\'max\')\n
\n
select_dict = params.get(\'select_dict\') or dict()\n
select_dict.update(dict(total_debit=None,\n
total_credit=None,\n
reference=None,\n
specific_reference=None,\n
project_uid=None,\n
payment_uid=None,\n
mirror_section_uid=None,\n
operation_date=None))\n
\n
params[\'select_dict\'] = select_dict\n
\n
# We group by uid to really filter duplicated lines, but this makes generated\n
# query much slower, and in reality duplicated lines are transactions for which\n
# both source section and destination section match the criterions. This can be\n
# because there are no criterion on section_uid or because both sections are members\n
# of the selected group. In the later it can be accepted as not a problem.\n
if not params.get(\'accounting_transaction.section_uid\'):\n
params.setdefault(\'group_by\', (\'uid\',))\n
\n
return context.searchFolder(**params)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>from_date=None, to_date=None, **params</string> </value>