Commit 6549fb6c authored by Yoshinori Okuji's avatar Yoshinori Okuji

2010-09-08 yo

* Auto-fill mirror accounts, if necessary, before running the accounting transaction constraint.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@38190 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 32de78e3
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </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># Auto-fill mirror accounts in transaction lines automatically, if necessary.\n
portal = context.getPortalObject()\n
movement_data_list = []\n
has_source = False\n
has_destination = False\n
for movement in context.contentValues(portal_type=portal.getPortalAccountingMovementTypeList()):\n
source_account = movement.getSourceValue(portal_type=\'Account\')\n
destination_account = movement.getDestinationValue(portal_type=\'Account\')\n
if source_account is not None:\n
has_source = True\n
if destination_account is not None:\n
has_destination = True\n
# Interested in movements which lack one side only.\n
if (source_account is not None) ^ (destination_account is not None):\n
movement_data_list((movement, source_account, destination_account))\n
\n
# If both are true, mirror accounting is used.\n
if has_source and has_destination:\n
for movement, source_account, destination_account in movement_data_list:\n
if source_account is None:\n
account = destination_account\n
base_category = \'source\'\n
else:\n
account = source_account\n
base_category = \'destination\'\n
\n
mirror_account = account.getDefaultDestination()\n
if mirror_account:\n
movement.setProperty(base_category, mirror_account)\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</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>kw</string>
<string>_getattr_</string>
<string>context</string>
<string>portal</string>
<string>movement_data_list</string>
<string>False</string>
<string>has_source</string>
<string>has_destination</string>
<string>_getiter_</string>
<string>movement</string>
<string>source_account</string>
<string>destination_account</string>
<string>None</string>
<string>True</string>
<string>account</string>
<string>base_category</string>
<string>mirror_account</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>AccountingTransaction_setDefaultMirrorAccountList</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -2,10 +2,7 @@ ...@@ -2,10 +2,7 @@
<ZopeData> <ZopeData>
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<tuple> <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
...@@ -68,6 +65,9 @@ transaction = state_change[\'object\']\n ...@@ -68,6 +65,9 @@ transaction = state_change[\'object\']\n
if not transaction.getStartDate() and transaction.getStopDate():\n if not transaction.getStartDate() and transaction.getStopDate():\n
transaction.setStartDate(transaction.getStopDate())\n transaction.setStartDate(transaction.getStopDate())\n
\n \n
# XXX auto-fill mirror accounts, if necessary.\n
transaction.AccountingTransaction_setDefaultMirrorAccountList()\n
\n
# Check constraints\n # Check constraints\n
transaction.Base_checkConsistency()\n transaction.Base_checkConsistency()\n
\n \n
......
2010-09-08 yo
* Auto-fill mirror accounts, if necessary, before running the accounting transaction constraint.
2010-09-08 yusei 2010-09-08 yusei
Revert my change on AccountingTransactionModule_getJournalSectionLineList at 2010-09-02. Revert my change on AccountingTransactionModule_getJournalSectionLineList at 2010-09-02.
......
1349 1350
\ No newline at end of file \ No newline at end of file
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