Commit 72dfb2c4 authored by Jérome Perrin's avatar Jérome Perrin

accounting: apply the same change than GL on account statement

parent 8c313674
......@@ -30,7 +30,9 @@
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
......@@ -73,7 +75,7 @@
<key> <string>text</string> </key>
<value> <string encoding="cdata"><![CDATA[
string:${object_url}/AccountModule_viewAccountStatementReportDialog?your_portal_skin=ODS&your_format=
string:${object_url}/AccountModule_viewAccountStatementReportDialog?your_portal_skin=ODS&your_format=&field_your_export:int=1
]]></string> </value>
</item>
......
......@@ -77,7 +77,7 @@
<key> <string>text</string> </key>
<value> <string encoding="cdata"><![CDATA[
string:${object_url}/accounting_module/AccountModule_viewAccountStatementReportDialog?mirror_section=${object/getRelativeUrl}&your_portal_skin=ODS&your_format=
string:${object_url}/accounting_module/AccountModule_viewAccountStatementReportDialog?mirror_section=${object/getRelativeUrl}&your_portal_skin=ODS&your_format=&field_your_export:int=1
]]></string> </value>
</item>
......
......@@ -77,7 +77,7 @@
<key> <string>text</string> </key>
<value> <string encoding="cdata"><![CDATA[
string:${object_url}/accounting_module/AccountModule_viewAccountStatementReportDialog?mirror_section=${object/getRelativeUrl}&your_portal_skin=ODS&your_format=
string:${object_url}/accounting_module/AccountModule_viewAccountStatementReportDialog?mirror_section=${object/getRelativeUrl}&your_portal_skin=ODS&your_format=&field_your_export:int=1
]]></string> </value>
</item>
......
......@@ -90,6 +90,8 @@ period_start_date = context\\\n
section_category=request[\'section_category\'],\n
date=from_date or at_date)\n
\n
export = request[\'export\']\n
\n
# Also get the currency, to know the precision\n
currency = context.Base_getCurrencyForSection(request[\'section_category\'])\n
precision = context.account_module.getQuantityPrecisionFromResource(currency)\n
......@@ -144,21 +146,27 @@ if hide_analytic:\n
else:\n
analytic_column_list = context.AccountModule_getAnalyticColumnList()\n
params[\'analytic_column_list\'] = analytic_column_list\n
request.set(\'analytic_column_list\', analytic_column_list) # for Movement_getExplanationTitleAndAnalytics\n
\n
selection_columns = (\n
(\'date\', \'Operation Date\'),\n
(\'Movement_getSpecificReference\', \'Transaction Reference\'),\n
(\'date\', \'Date\'),\n
(\'Movement_getExplanationTitle\', \'Accounting Transaction Title\'), )\n
(\'Movement_getExplanationTitleAndAnalytics\', \'Title\\nReference and Analytics\' if analytic_column_list else \'Title\\nReference\'),\n
)\n
if len(section_uid) > 1:\n
selection_columns += ( (\'section_title\', \'Section\'), )\n
selection_columns += analytic_column_list\n
if not mirror_section:\n
selection_columns += ( (\'Movement_getMirrorSectionTitle\', \'Third Party\'), )\n
selection_columns += ((\'section_title\', \'Section\'),)\n
selection_columns += (\n
(\'Movement_getExplanationReference\', \'Document Reference\'),\n
(\'debit_price\', \'Debit\'),\n
(\'credit_price\', \'Credit\'),\n
(\'running_total_price\', \'Net\'),)\n
(\'running_total_price\', \'Running Balance\'),\n
(\'grouping_reference\', \'Grouping Reference\'),\n
(\'grouping_date\', \'Grouping Date\'),\n
(\'modification_date\', \'Modification Date\'),\n
(\'getTranslatedSimulationStateTitle\', \'State\'),\n
)\n
\n
if export:\n
selection_columns = context.AccountModule_getGeneralLedgerColumnItemList()\n
\n
report_section_list = []\n
if from_date and detailed_from_date_summary:\n
......@@ -185,7 +193,7 @@ if from_date and detailed_from_date_summary:\n
report_section_list.append(\n
ReportSection(\n
path=node,\n
form_id=\'Account_viewAccountingTransactionList\',\n
form_id=\'Account_viewAccountingTransactionListExport\' if export else \'Account_viewAccountingTransactionList\',\n
selection_name=\'account_preference_selection\',\n
selection_params=params,\n
selection_columns=selection_columns,\n
......
......@@ -112,6 +112,7 @@
<list>
<string>your_simulation_state</string>
<string>your_portal_type</string>
<string>your_export</string>
</list>
</value>
</item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>css_class</string>
<string>hidden</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_export</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>css_class</string> </key>
<value> <string>hidden_label</string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_checkbox</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Export Mode</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -51,12 +51,9 @@
<item>
<key> <string>_body</string> </key>
<value> <string>from Products.PythonScripts.standard import Object\n
from Products.ERP5Type.Document import newTempBase\n
from Products.ERP5Type.Message import Message\n
portal = context.getPortalObject()\n
getObject = portal.portal_catalog.getObject\n
params = portal.ERP5Accounting_getParams(selection_name)\n
N_ = lambda msg: Message(\'erp5_ui\', msg)\n
\n
# this also prevents to be called directly\n
assert \'node_uid\' in kw\n
......@@ -86,87 +83,70 @@ for brain in portal.Base_zGetNotGroupedMovementList(\n
portal_type=portal.getPortalAccountingMovementTypeList(),\n
section_uid=params[\'section_uid\']):\n
\n
# manually filter out not interesting lines\n
# XXX this is because Base_zGetNotGroupedMovementList is really\n
# minimalistic\n
if mirror_section_relative_url and \\\n
brain.mirror_section_relative_url != mirror_section_relative_url:\n
continue\n
\n
mvt = brain.getObject()\n
transaction = mvt.getParentValue()\n
\n
if portal_type_filter and \\\n
transaction.getPortalType() not in portal_type_list:\n
continue\n
# manually filter out not interesting lines\n
# XXX this is because Base_zGetNotGroupedMovementList is really\n
# minimalistic\n
if mirror_section_relative_url and \\\n
brain.mirror_section_relative_url != mirror_section_relative_url:\n
continue\n
\n
is_source = (brain.mirror_section_relative_url == mvt.getDestinationSection())\n
if is_source:\n
if payment_uid and mvt.getSourcePaymentUid() != payment_uid:\n
continue\n
if project_uid and mvt.getSourceProjectUid() != project_uid:\n
continue\n
if function and not (mvt.getSourceFunction() or \'\').startswith(function):\n
continue\n
specific_reference = transaction.getSourceReference()\n
mirror_section_title = mvt.getDestinationSectionTitle()\n
section_title = mvt.getSourceSectionTitle()\n
else:\n
if payment_uid and mvt.getDestinationPaymentUid() != payment_uid:\n
continue\n
if project_uid and mvt.getDestinationProjectUid() != project_uid:\n
continue\n
if function and not (mvt.getDestinationFunction() or \'\').startswith(function):\n
continue\n
specific_reference = transaction.getDestinationReference()\n
mirror_section_title = mvt.getSourceSectionTitle()\n
section_title = mvt.getDestinationSectionTitle()\n
\n
mvt = brain.getObject()\n
transaction = mvt.getParentValue()\n
\n
if portal_type_filter and \\\n
transaction.getPortalType() not in portal_type_list:\n
continue\n
\n
debit = max(brain.total_quantity, 0)\n
total_debit += debit\n
credit = max(-brain.total_quantity, 0)\n
total_credit += credit\n
is_source = (brain.mirror_section_relative_url == mvt.getDestinationSection())\n
if is_source:\n
if payment_uid and mvt.getSourcePaymentUid() != payment_uid:\n
continue\n
if project_uid and mvt.getSourceProjectUid() != project_uid:\n
continue\n
if function and not (mvt.getSourceFunction() or \'\').startswith(function):\n
continue\n
specific_reference = transaction.getSourceReference()\n
mirror_section_title = mvt.getDestinationSectionTitle()\n
section_title = mvt.getSourceSectionTitle()\n
else:\n
if payment_uid and mvt.getDestinationPaymentUid() != payment_uid:\n
continue\n
if project_uid and mvt.getDestinationProjectUid() != project_uid:\n
continue\n
if function and not (mvt.getDestinationFunction() or \'\').startswith(function):\n
continue\n
specific_reference = transaction.getDestinationReference()\n
mirror_section_title = mvt.getSourceSectionTitle()\n
section_title = mvt.getDestinationSectionTitle()\n
\n
\n
debit_price = max(brain.total_price, 0)\n
total_debit_price += debit_price\n
credit_price = max(-brain.total_price, 0)\n
total_credit_price += credit_price\n
debit = max(brain.total_quantity, 0)\n
total_debit += debit\n
credit = max(-brain.total_quantity, 0)\n
total_credit += credit\n
\n
brain_date = brain.date\n
if mvt.getStartDate():\n
brain_date = brain_date.toZone(mvt.getStartDate().timezone())\n
\n
line = Object(uid=\'new_000\',\n
total_price=brain.total_price,\n
date=brain.date,\n
Movement_getSpecificReference=specific_reference,\n
Movement_getMirrorSectionTitle=mirror_section_title,\n
section_title=section_title,\n
debit=debit,\n
credit=credit,\n
debit_price=debit_price,\n
credit_price=credit_price,\n
Movement_getExplanationTitle=\n
mvt.hasTitle() and mvt.getTitle() or transaction.getTitle())\n
debit_price = max(brain.total_price, 0)\n
total_debit_price += debit_price\n
credit_price = max(-brain.total_price, 0)\n
total_credit_price += credit_price\n
\n
analytic_info = {}\n
for analytic_column, analytic_column_title in analytic_column_list:\n
if analytic_column == \'project\':\n
if is_source:\n
analytic_info[\'project\'] = mvt.asContext(project_uid=mvt.getSourceProjectUid()).Movement_getProjectTitle()\n
else:\n
analytic_info[\'project\'] = mvt.asContext(project_uid=mvt.getDestinationProjectUid()).Movement_getProjectTitle()\n
elif analytic_column == \'function\':\n
if is_source:\n
analytic_info[\'function\'] = mvt.asContext(function_uid=mvt.getDestinationFunctionUid()).Movement_getFunctionTitle()\n
else:\n
analytic_info[\'function\'] = mvt.asContext(function_uid=mvt.getDestinationFunctionUid()).Movement_getFunctionTitle()\n
else:\n
analytic_info[analytic_column] = mvt.getProperty(analytic_column)\n
brain_date = brain.date\n
if mvt.getStartDate():\n
brain_date = brain_date.toZone(mvt.getStartDate().timezone())\n
\n
line = Object(uid=\'new_000\',\n
total_price=brain.total_price,\n
date=brain.date,\n
Movement_getSpecificReference=specific_reference,\n
mirror_section_title=mirror_section_title,\n
section_title=section_title,\n
debit=debit,\n
credit=credit,\n
debit_price=debit_price,\n
credit_price=credit_price,\n
Movement_getExplanationTitleAndAnalytics=brain.Movement_getExplanationTitleAndAnalytics(brain))\n
\n
line.update(analytic_info)\n
line_list.append(line)\n
line_list.append(line)\n
\n
\n
context.REQUEST.set(\n
......
This diff is collapsed.
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