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 @@
</item>
<item>
<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
if brain is not None :\n
transaction = brain.getObject()\n
transaction = context\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
result = context.AccountingTransactionModule_zGetAccountingTransactionList(selection=selection, **kw)\n
row = result[0]\n
return float(\'%.02f\' % (row.total_price or 0.0))\n
</string> </value>
</item>
<item>
......@@ -134,17 +129,16 @@ return credit\n
<string>brain</string>
<string>selection</string>
<string>kw</string>
<string>None</string>
<string>_getattr_</string>
<string>params</string>
<string>_write_</string>
<string>context</string>
<string>accounting_transaction_lines_portal_types</string>
<string>None</string>
<string>transaction</string>
<string>credit</string>
<string>group_category</string>
<string>_getiter_</string>
<string>line</string>
<string>source_section</string>
<string>destination_section</string>
<string>_apply_</string>
<string>result</string>
<string>_getitem_</string>
<string>row</string>
<string>float</string>
</tuple>
</value>
</item>
......
......@@ -66,25 +66,19 @@
</item>
<item>
<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
if brain is not None :\n
transaction = brain.getObject()\n
transaction = context\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
result = context.AccountingTransactionModule_zGetAccountingTransactionList(selection=selection, selection_params=kw, **kw)\n
row = result[0]\n
return float(\'%.02f\' % (row.total_price and - row.total_price or 0.0))\n
</string> </value>
</item>
<item>
......@@ -134,17 +128,16 @@ return debit\n
<string>brain</string>
<string>selection</string>
<string>kw</string>
<string>None</string>
<string>_getattr_</string>
<string>params</string>
<string>_write_</string>
<string>context</string>
<string>accounting_transaction_lines_portal_types</string>
<string>None</string>
<string>transaction</string>
<string>debit</string>
<string>group_category</string>
<string>_getiter_</string>
<string>line</string>
<string>source_section</string>
<string>destination_section</string>
<string>_apply_</string>
<string>result</string>
<string>_getitem_</string>
<string>row</string>
<string>float</string>
</tuple>
</value>
</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