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

complete source/destination section independance

(FIXME: the naming of the script is wrong then)


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5603 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 00c48041
......@@ -68,26 +68,23 @@
<key> <string>_body</string> </key>
<value> <string>accounting_transaction_lines_portal_types = context.getPortalAccountingMovementTypeList()\n
\n
transaction = brain.getObject()\n
credit = 0\n
for line in transaction.objectValues() :\n
if line.getPortalType() in accounting_transaction_lines_portal_types :\n
credit += line.getSourceCredit()\n
if line.getSourceSection() == line.getDestinationSection() : \n
credit += line.getSourceCredit()\n
return credit\n
if brain is not None :\n
transaction = brain.getObject()\n
transaction = context\n
\n
## old implementation with portal_catalog:\n
params = selection.getParams()\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
credit = 0\n
group_category = context.getPortalObject().portal_preferences\\\n
.getPreferredAccountingTransactionSectionCategory()\n
\n
result = context.AccountingTransactionModule_zGetAccountingTransactionList(selection=selection, **kw)\n
row = result[0]\n
return float(\'%.02f\' % (row.quantity or 0.0))\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>
</item>
<item>
......@@ -96,9 +93,15 @@ return float(\'%.02f\' % (row.quantity or 0.0))\n
<none/>
</value>
</item>
<item>
<key> <string>_dav_writelocks</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value> <string>Script (Python):/nexedi/portal_skins/local_accounting/AccountingTransactionModule_getSourceCredit</string> </value>
<value> <string>Script (Python):/erp5/portal_skins/erp5_accounting/AccountingTransactionModule_getSourceCredit</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
......@@ -134,17 +137,14 @@ return float(\'%.02f\' % (row.quantity or 0.0))\n
<string>_getattr_</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>params</string>
<string>_write_</string>
<string>_apply_</string>
<string>result</string>
<string>_getitem_</string>
<string>row</string>
<string>float</string>
<string>source_section</string>
<string>destination_section</string>
</tuple>
</value>
</item>
......@@ -175,4 +175,25 @@ return float(\'%.02f\' % (row.quantity or 0.0))\n
</dictionary>
</pickle>
</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>
......@@ -68,29 +68,23 @@
<key> <string>_body</string> </key>
<value> <string>accounting_transaction_lines_portal_types = context.getPortalAccountingMovementTypeList()\n
\n
transaction = brain.getObject()\n
if brain is not None :\n
transaction = brain.getObject()\n
transaction = context\n
debit = 0\n
for line in transaction.objectValues() :\n
if line.getPortalType() in accounting_transaction_lines_portal_types :\n
debit += line.getSourceDebit()\n
if line.getSourceSection() == line.getDestinationSection() : \n
debit += line.getSourceDebit()\n
return debit\n
\n
## old implementation with portal_catalog:\n
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
group_category = context.getPortalObject().portal_preferences\\\n
.getPreferredAccountingTransactionSectionCategory()\n
\n
result = context.AccountingTransactionModule_zGetAccountingTransactionList(selection=selection,selection_params=kw, **kw)\n
row = result[0]\n
return float(\'%.02f\' % (row.quantity and - row.quantity or 0.0))\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>
</item>
<item>
......@@ -99,9 +93,15 @@ return float(\'%.02f\' % (row.quantity and - row.quantity or 0.0))\n
<none/>
</value>
</item>
<item>
<key> <string>_dav_writelocks</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value> <string>Script (Python):/nexedi/portal_skins/local_accounting/AccountingTransactionModule_getSourceDebit</string> </value>
<value> <string>Script (Python):/erp5/portal_skins/erp5_accounting/AccountingTransactionModule_getSourceDebit</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
......@@ -137,18 +137,14 @@ return float(\'%.02f\' % (row.quantity and - row.quantity or 0.0))\n
<string>_getattr_</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>None</string>
<string>params</string>
<string>_write_</string>
<string>_apply_</string>
<string>result</string>
<string>_getitem_</string>
<string>row</string>
<string>float</string>
<string>source_section</string>
<string>destination_section</string>
</tuple>
</value>
</item>
......@@ -179,4 +175,25 @@ return float(\'%.02f\' % (row.quantity and - row.quantity or 0.0))\n
</dictionary>
</pickle>
</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>
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