Commit cca00212 authored by Jérome Perrin's avatar Jérome Perrin

use total_price instead of quantity

be side independant
use at_date instead of to_date
make it work


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5607 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c57cb8fc
...@@ -76,86 +76,82 @@ Client & vendors accounts.\n ...@@ -76,86 +76,82 @@ Client & vendors accounts.\n
from Products.ERP5Form.Report import ReportSection\n from Products.ERP5Form.Report import ReportSection\n
\n \n
request = context.REQUEST\n request = context.REQUEST\n
to_date = request[\'to_date\']\n at_date = request[\'at_date\']\n
transaction_section_category = request[\'transaction_section_category\']\n transaction_section_category = request[\'transaction_section_category\']\n
transaction_simulation_state = request[\'transaction_simulation_state\']\n transaction_simulation_state = request[\'transaction_simulation_state\']\n
role_filter_list = request.get(\'entity_role\', None)\n role_filter_list = request.get(\'entity_role\', None)\n
omit_balanced_accounts = request[\'omit_balanced_accounts\']\n omit_balanced_accounts = request[\'omit_balanced_accounts\']\n
omit_empty_accounts = request[\'omit_empty_accounts\']\n
from_date = request.get(\'from_date\', None)\n from_date = request.get(\'from_date\', None)\n
accounting_transaction_line_currency = request.get(\'accounting_transaction_line_currency\', None)\n
\n \n
# role_filter_list == None means no filter on the role\n # role_filter_list == None means no filter on the role\n
if role_filter_list == [\'\'] : \n if role_filter_list == [\'\'] :\n
role_filter_list = None\n role_filter_list = None\n
\n \n
result = []\n result = []\n
\n \n
params = { \n params = {\n
\'to_date\' : to_date,\n \'at_date\' : at_date,\n
\'transaction_section_category\' : transaction_section_category,\n \'transaction_section_category\' : transaction_section_category,\n
\'section_category\' : transaction_section_category,\n \'section_category\' : transaction_section_category,\n
\'simulation_state\' : transaction_simulation_state,\n \'simulation_state\' : transaction_simulation_state,\n
\'accounting_transaction_line_currency\' : None,\n
\'report_depth\' : 5,\n \'report_depth\' : 5,\n
\'node_category\': [ \'account_type/asset/receivable\',\n
\'account_type/liability/payable\' ]\n
}\n }\n
\n \n
params[\'hide_grouping\'] = request[\'omit_grouped_references\']\n params[\'hide_grouping\'] = request[\'omit_grouped_references\']\n
if from_date: \n if from_date:\n
params[\'from_date\'] = from_date\n params[\'from_date\'] = from_date\n
\n \n
portal = context.portal_url.getPortalObject()\n portal = context.portal_url.getPortalObject()\n
simulation_tool = portal.portal_simulation\n
\n \n
entity_columns = [\n entity_columns = [\n
(\'getStopDate\', \'Date\'),\n (\'date\', \'Date\'),\n
(\'Entity_getParentPortalType\', \'Type\'),\n (\'translated_portal_type\', \'Type\'),\n
(\'Entity_getSourceGapId\', \'GAP\'),\n (\'Entity_getAccountingTransactionGapId\', \'GAP\'),\n
(\'Entity_getReference\', \'Invoice No\'), \n (\'parent_reference\', \'Invoice No\'),\n
(\'Entity_getParentTitle\', \'Title\'), \n (\'parent_title\', \'Title\'),\n
(\'Entity_getSourceReference\', \'Reference\'),\n (\'parent_specific_reference\', \'Reference\'),\n
(\'simulation_state\', \'State\'),\n (\'translated_simulation_state_title\', \'State\'),\n
(\'source_debit\', \'Debit\'),\n (\'debit\', \'Debit\'),\n
(\'source_credit\', \'Credit\'),\n (\'credit\', \'Credit\'),\n
(\'source_balance\', \'Balance\'),\n (\'net_balance\', \'Balance\'),\n
]\n ]\n
if not params[\'hide_grouping\'] :\n if not params[\'hide_grouping\'] :\n
entity_columns.append((\'grouping_reference\', \'Grouping Reference\'))\n entity_columns.append((\'grouping_reference\',\n
\n \'Grouping Reference\'))\n
# to be able to use Entity_statBalance, Entity_zGetAccountingTransactionList, we must edit accounting_selection\n
# FIXME: instead we should use getInvetory and portal_catalog\n
saved_params = context.portal_selections.getSelectionParams("accounting_selection")\n
context.portal_selections.setSelectionParamsFor("accounting_selection", params)\n
\n \n
for party in context.Account_zDistinctSectionList():\n for party in context.Account_zDistinctSectionList():\n
o = party.getObject() \n o = party.getObject()\n
if role_filter_list and hasattr(o, \'getRole\') and o.getRole() not in role_filter_list : \n if role_filter_list and hasattr(o, \'getRole\') and \\\n
o.getRole() not in role_filter_list :\n
continue\n continue\n
if hasattr(o, \'getGroup\') and o.getGroup() : \n if hasattr(o, \'getGroup\') and o.getGroup() :\n
group = \'group/%s\'%o.getGroup()\n group = \'group/%s\'%o.getGroup()\n
else : \n else :\n
group = ""\n group = ""\n
if group != transaction_section_category : # don\'t show entities belonging to the group we are reporting\n if group != transaction_section_category :\n
if omit_empty_accounts and (len(o.Entity_zGetAccountingTransactionList(**params)) == 0) :\n # don\'t show entities belonging to the group we are reporting\n
pass\n if omit_balanced_accounts and simulation_tool.getInventoryAssetPrice(\n
elif omit_balanced_accounts and (int(o.Entity_statBalance(**params)) == 0) :\n mirror_section_uid=party.getUid(), **params) == 0 :\n
pass\n pass\n
else : \n else :\n
if hasattr(o, \'getRole\') and o.getRole() : \n if hasattr(o, \'getRole\') and o.getRole() :\n
title = \'%s (%s)\'%(o.getTitle(), o.getRole())\n title = \'%s (%s)\'%(o.getTitle(), o.getRole())\n
else : \n else :\n
title = o.getTitle()\n title = o.getTitle()\n
result.append(\n result.append(\n
ReportSection(title=title,\n ReportSection(title=title,\n
level=2,\n level=2,\n
path=o.getPhysicalPath(), \n path=o.getPhysicalPath(),\n
form_id=\'Entity_viewAccountingTransactionList\',\n form_id=\'Entity_viewAccountingTransactionList\',\n
## XXX Here we must use accounting_selection, because stat scripts read this selection \n
selection_name = \'accounting_selection\',\n selection_name = \'accounting_selection\',\n
selection_params = params,\n selection_params = params,\n
selection_columns = entity_columns,\n selection_columns = entity_columns,\n
selection_sort_order=[(\'delivery.stop_date\', \'ascending\')], ) )\n selection_sort_order=[(\'delivery.stop_date\',\n
\'ascending\')], ) )\n
\n \n
context.portal_selections.setSelectionParamsFor("accounting_selection", saved_params)\n
return result\n return result\n
...@@ -167,9 +163,15 @@ return result\n ...@@ -167,9 +163,15 @@ return result\n
<none/> <none/>
</value> </value>
</item> </item>
<item>
<key> <string>_dav_writelocks</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>_filepath</string> </key> <key> <string>_filepath</string> </key>
<value> <string>Script (Python):/nexedi/portal_skins/erp5_accounting/AccountModule_getOtherPartiesReportSectionList</string> </value> <value> <string>Script (Python):/erp5/portal_skins/erp5_accounting/AccountModule_getOtherPartiesReportSectionList</string> </value>
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
...@@ -213,29 +215,25 @@ return result\n ...@@ -213,29 +215,25 @@ return result\n
<string>context</string> <string>context</string>
<string>request</string> <string>request</string>
<string>_getitem_</string> <string>_getitem_</string>
<string>to_date</string> <string>at_date</string>
<string>transaction_section_category</string> <string>transaction_section_category</string>
<string>transaction_simulation_state</string> <string>transaction_simulation_state</string>
<string>None</string> <string>None</string>
<string>role_filter_list</string> <string>role_filter_list</string>
<string>omit_balanced_accounts</string> <string>omit_balanced_accounts</string>
<string>omit_empty_accounts</string>
<string>from_date</string> <string>from_date</string>
<string>accounting_transaction_line_currency</string>
<string>result</string> <string>result</string>
<string>params</string> <string>params</string>
<string>_write_</string> <string>_write_</string>
<string>portal</string> <string>portal</string>
<string>simulation_tool</string>
<string>entity_columns</string> <string>entity_columns</string>
<string>saved_params</string>
<string>_getiter_</string> <string>_getiter_</string>
<string>party</string> <string>party</string>
<string>o</string> <string>o</string>
<string>hasattr</string> <string>hasattr</string>
<string>group</string> <string>group</string>
<string>len</string>
<string>_apply_</string> <string>_apply_</string>
<string>int</string>
<string>title</string> <string>title</string>
</tuple> </tuple>
</value> </value>
...@@ -264,4 +262,25 @@ return result\n ...@@ -264,4 +262,25 @@ return result\n
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Persistence</string>
<string>PersistentMapping</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_container</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
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