diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_getSourceCredit.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_getSourceCredit.xml index a8a90c4d19c00f91083652d951494f9a9c09eca6..472f0b3887845c97286ef770c343be94f12daff3 100755 --- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_getSourceCredit.xml +++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_getSourceCredit.xml @@ -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> diff --git a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_getSourceDebit.xml b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_getSourceDebit.xml index 2de0d46d02bdd67a82a086f3bf86b34f607ffdd6..0813fa07b16d37206b98ff98c23bda7844eb8383 100755 --- a/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_getSourceDebit.xml +++ b/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_getSourceDebit.xml @@ -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>