Commit 31de44c5 authored by Jérome Perrin's avatar Jérome Perrin

use catalog to calculate per line total debit / credit


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5697 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d24aafd8
...@@ -66,25 +66,20 @@ ...@@ -66,25 +66,20 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>accounting_transaction_lines_portal_types = context.getPortalAccountingMovementTypeList()\n <value> <string>if selection is not None:\n
params = selection.getParams()\n
else:\n
params = {}\n
kw = {} \n
kw[\'section_category\'] = params.get(\'section_category\')\n
kw[\'stat\'] = 1\n
kw[\'omit_output\'] = 1\n
kw[\'transaction\'] = context.getUid()\n
kw[\'delivery.start_date\'] = "%"\n
\n \n
if brain is not None :\n result = context.AccountingTransactionModule_zGetAccountingTransactionList(selection=selection, **kw)\n
transaction = brain.getObject()\n row = result[0]\n
transaction = context\n return float(\'%.02f\' % (row.total_price or 0.0))\n
\n
credit = 0\n
group_category = context.getPortalObject().portal_preferences\\\n
.getPreferredAccountingTransactionSectionCategory()\n
\n
for line in transaction.contentValues(\n
filter={\'portal_type\': accounting_transaction_lines_portal_types} ) :\n
source_section = line.getSourceSectionValue()\n
if source_section is not None and source_section.isMemberOf(group_category) :\n
credit += line.getSourceInventoriatedTotalAssetCredit() or 0\n
destination_section = line.getDestinationSectionValue()\n
if destination_section is not None and destination_section.isMemberOf(group_category) :\n
credit += line.getDestinationInventoriatedTotalAssetCredit() or 0\n
return credit\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -134,17 +129,16 @@ return credit\n ...@@ -134,17 +129,16 @@ return credit\n
<string>brain</string> <string>brain</string>
<string>selection</string> <string>selection</string>
<string>kw</string> <string>kw</string>
<string>None</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>params</string>
<string>_write_</string>
<string>context</string> <string>context</string>
<string>accounting_transaction_lines_portal_types</string> <string>_apply_</string>
<string>None</string> <string>result</string>
<string>transaction</string> <string>_getitem_</string>
<string>credit</string> <string>row</string>
<string>group_category</string> <string>float</string>
<string>_getiter_</string>
<string>line</string>
<string>source_section</string>
<string>destination_section</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -66,25 +66,19 @@ ...@@ -66,25 +66,19 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>accounting_transaction_lines_portal_types = context.getPortalAccountingMovementTypeList()\n <value> <string>if selection is not None:\n
params = selection.getParams()\n
else:\n
params = {}\n
kw = {}\n
kw[\'section_category\'] = params.get(\'section_category\')\n
kw[\'stat\'] = 1\n
kw[\'omit_input\'] = 1\n
kw[\'transaction\'] = context.getUid()\n
\n \n
if brain is not None :\n result = context.AccountingTransactionModule_zGetAccountingTransactionList(selection=selection, selection_params=kw, **kw)\n
transaction = brain.getObject()\n row = result[0]\n
transaction = context\n return float(\'%.02f\' % (row.total_price and - row.total_price or 0.0))\n
debit = 0\n
\n
group_category = context.getPortalObject().portal_preferences\\\n
.getPreferredAccountingTransactionSectionCategory()\n
\n
for line in transaction.contentValues(\n
filter={\'portal_type\': accounting_transaction_lines_portal_types} ) :\n
source_section = line.getSourceSectionValue()\n
if source_section is not None and source_section.isMemberOf(group_category) :\n
debit += line.getSourceInventoriatedTotalAssetDebit() or 0\n
destination_section = line.getDestinationSectionValue()\n
if destination_section is not None and destination_section.isMemberOf(group_category) :\n
debit += line.getDestinationInventoriatedTotalAssetDebit() or 0\n
return debit\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -134,17 +128,16 @@ return debit\n ...@@ -134,17 +128,16 @@ return debit\n
<string>brain</string> <string>brain</string>
<string>selection</string> <string>selection</string>
<string>kw</string> <string>kw</string>
<string>None</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>params</string>
<string>_write_</string>
<string>context</string> <string>context</string>
<string>accounting_transaction_lines_portal_types</string> <string>_apply_</string>
<string>None</string> <string>result</string>
<string>transaction</string> <string>_getitem_</string>
<string>debit</string> <string>row</string>
<string>group_category</string> <string>float</string>
<string>_getiter_</string>
<string>line</string>
<string>source_section</string>
<string>destination_section</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
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