[Erp5-report] r6370 - /erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_ac...
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Mar 31 01:38:12 CEST 2006
Author: kevin
Date: Fri Mar 31 01:38:10 2006
New Revision: 6370
URL: http://svn.erp5.org?rev=6370&view=rev
Log:
New scipt and dialog to automate the closing of an accouting period when, at the end of the fiscal year, we sum up all acounts to calculate final benefits and looses.
Added:
erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_createClosingTransaction.xml
Added: erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_createClosingTransaction.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_createClosingTransaction.xml?rev=6370&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_createClosingTransaction.xml (added)
+++ erp5/trunk/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_createClosingTransaction.xml Fri Mar 31 01:38:10 2006
@@ -1,0 +1,226 @@
+<?xml version="1.0"?>
+<ZopeData>
+ <record id="1" aka="AAAAAAAAAAE=">
+ <pickle>
+ <tuple>
+ <tuple>
+ <string>Products.PythonScripts.PythonScript</string>
+ <string>PythonScript</string>
+ </tuple>
+ <none/>
+ </tuple>
+ </pickle>
+ <pickle>
+ <dictionary>
+ <item>
+ <key> <string>Python_magic</string> </key>
+ <value> <string encoding="base64">O/INCg==</string> </value>
+ </item>
+ <item>
+ <key> <string>Script_magic</string> </key>
+ <value> <int>3</int> </value>
+ </item>
+ <item>
+ <key> <string>__ac_local_roles__</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>_bind_names</string> </key>
+ <value>
+ <object>
+ <klass>
+ <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
+ </klass>
+ <tuple/>
+ <state>
+ <dictionary>
+ <item>
+ <key> <string>_asgns</string> </key>
+ <value>
+ <dictionary>
+ <item>
+ <key> <string>name_container</string> </key>
+ <value> <string>container</string> </value>
+ </item>
+ <item>
+ <key> <string>name_context</string> </key>
+ <value> <string>context</string> </value>
+ </item>
+ <item>
+ <key> <string>name_m_self</string> </key>
+ <value> <string>script</string> </value>
+ </item>
+ <item>
+ <key> <string>name_subpath</string> </key>
+ <value> <string>traverse_subpath</string> </value>
+ </item>
+ </dictionary>
+ </value>
+ </item>
+ </dictionary>
+ </state>
+ </object>
+ </value>
+ </item>
+ <item>
+ <key> <string>_body</string> </key>
+ <value> <string>from DateTime import DateTime\n
+portal = context.getPortalObject()\n
+N_ = portal.Base_translateString\n
+accounting_module = portal.accounting_module\n
+getInventory = portal.portal_simulation.getInventoryAssetPrice\n
+\n
+# FIXME: maybe it is not good to use a Organisation here and not\n
+# a category ...\n
+if section is None :\n
+ section = portal_preferences.getPreferredSourceSection()\n
+ if section is None :\n
+ raise ValueError, N_("Section must be defined in Preferences")\n
+\n
+section_value = portal.restrictedTraverse(section)\n
+section_uid = section_value.getUid()\n
+resource = section_value.getPriceCurrency()\n
+currency = context.restrictedTraverse(resource)\n
+precision = currency.getQuantityPrecision()\n
+\n
+closing_transaction = accounting_module.newContent( portal_type = "Accounting Transaction"\n
+ , created_by_builder = 1\n
+ , source = section\n
+ , source_section = section\n
+ , resource = resource\n
+ , start_date = at_date\n
+ , title = N_(\'Balance of income and expense account\')\n
+ )\n
+\n
+total_quantity = 0.0\n
+for account in portal.portal_categories.account_type.income\\\n
+ .getAccountTypeRelatedValueList(portal_type = \'Account\') + \\\n
+ portal.portal_categories.account_type.expense\\\n
+ .getAccountTypeRelatedValueList(portal_type = \'Account\'):\n
+\n
+ quantity = getInventory( node_uid = account.getUid()\n
+ , omit_simulation = 1\n
+ , simulation_state = [\'stopped\', \'delivered\']\n
+ , section_uid = section_uid\n
+ , at_date = at_date\n
+ , section_portal_type_list = [\'Organisation\']\n
+ )\n
+ quantity = quantity or 0.0\n
+ total_quantity += context.Base_getRoundValue(quantity, precision)\n
+\n
+ context.log("kev closing", repr(account))\n
+ context.log("kev closing", repr(quantity))\n
+\n
+ if quantity != 0.0:\n
+ closing_transaction.newContent( portal_type = \'Accounting Transaction Line\'\n
+ , source_value = account\n
+ , quantity = quantity\n
+ )\n
+\n
+result_line = closing_transaction.newContent( portal_type = \'Accounting Transaction Line\'\n
+ , source = N_(\'Select your result account\')\n
+ , quantity = -total_quantity\n
+ )\n
+\n
+context.REQUEST.RESPONSE.redirect("%s/view?portal_status_message=%s" % (\n
+ closing_transaction.getPath(), N_(\'Closing Transaction Created.\')))\n
+</string> </value>
+ </item>
+ <item>
+ <key> <string>_code</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>_filepath</string> </key>
+ <value> <string>Script (Python):/nexedi/portal_skins/erp5_accounting/AccountingTransactionModule_createClosingTransaction</string> </value>
+ </item>
+ <item>
+ <key> <string>_owner</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>_params</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>errors</string> </key>
+ <value>
+ <tuple/>
+ </value>
+ </item>
+ <item>
+ <key> <string>func_code</string> </key>
+ <value>
+ <object>
+ <klass>
+ <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
+ </klass>
+ <tuple/>
+ <state>
+ <dictionary>
+ <item>
+ <key> <string>co_argcount</string> </key>
+ <value> <int>0</int> </value>
+ </item>
+ <item>
+ <key> <string>co_varnames</string> </key>
+ <value>
+ <tuple>
+ <string>DateTime</string>
+ <string>_getattr_</string>
+<string>context</string>
+ <string>portal</string>
+ <string>N_</string>
+ <string>accounting_module</string>
+ <string>getInventory</string>
+ <string>section</string>
+ <string>None</string>
+ <string>portal_preferences</string>
+ <string>ValueError</string>
+ <string>section_value</string>
+ <string>section_uid</string>
+ <string>resource</string>
+ <string>currency</string>
+ <string>precision</string>
+ <string>at_date</string>
+ <string>closing_transaction</string>
+ <string>total_quantity</string>
+ <string>_getiter_</string>
+ <string>account</string>
+ <string>quantity</string>
+ <string>repr</string>
+ <string>result_line</string>
+ </tuple>
+ </value>
+ </item>
+ </dictionary>
+ </state>
+ </object>
+ </value>
+ </item>
+ <item>
+ <key> <string>func_defaults</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>id</string> </key>
+ <value> <string>AccountingTransactionModule_createClosingTransaction</string> </value>
+ </item>
+ <item>
+ <key> <string>warnings</string> </key>
+ <value>
+ <tuple/>
+ </value>
+ </item>
+ </dictionary>
+ </pickle>
+ </record>
+</ZopeData>
More information about the Erp5-report
mailing list