Commit 6bf00303 authored by Jérome Perrin's avatar Jérome Perrin

Improve accounting workflow:

* Balance Transaction no longuer have a different path, they are only created and validated by the system anyway
* States manages Delete Object permission correctly
* remove obsolete script to check budget
* add a new intermediate state, "started" for use when you want to modify an "stopped" transaction (which is no longer editable directly)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18866 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 16044fd2
......@@ -49,6 +49,7 @@
<string>View</string>
<string>Access contents information</string>
<string>Add portal content</string>
<string>Delete objects</string>
</tuple>
</value>
</item>
......
......@@ -65,7 +65,10 @@
</item>
<item>
<key> <string>_body</string> </key>
<value> <string>transaction = state_change[\'object\']\n
<value> <string>"""Set automatic references on the document.\n
"""\n
\n
transaction = state_change[\'object\']\n
\n
# Get sections.\n
source_section = transaction.getSourceSection()\n
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Python_magic</string> </key>
<value>
<none/>
</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 Products.DCWorkflow.DCWorkflow import ValidationFailed\n
\n
error_message = \'\'\n
\n
# Balance Transaction.\n
transaction = state_change[\'object\']\n
module = transaction.getParentValue()\n
\n
# Get sections and a currency.\n
source_section = transaction.getSourceSection()\n
\n
if source_section in (None, \'\'):\n
error_message = \'source_section is not defined\'\n
else:\n
for t in module.contentValues(filter={\'portal_type\':\'Balance Transaction\'}):\n
if t.getSimulationState() == \'delivered\':\n
error_message = \'another balance transaction is already defined\'\n
break\n
else:\n
dict = {}\n
for line in transaction.contentValues(filter={\'portal_type\':\'Balance Transaction Line\'}):\n
key_list = (line.getSource(), line.getDestinationSection(), line.getSourcePayment())\n
if key_list in dict:\n
error_message = \'More than one lines are defined for the account %s, the third party %s and the bank account %s\' % key_list\n
break\n
dict[key_list] = 1\n
\n
\n
if error_message != \'\':\n
raise ValidationFailed, \'Action impossible : \'+error_message\n
\n
# if it\'s ok, validate the lines\n
container.validateTransactionLines(state_change)\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>state_change</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>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>state_change</string>
<string>Products.DCWorkflow.DCWorkflow</string>
<string>ValidationFailed</string>
<string>error_message</string>
<string>_getitem_</string>
<string>transaction</string>
<string>_getattr_</string>
<string>module</string>
<string>source_section</string>
<string>None</string>
<string>_getiter_</string>
<string>t</string>
<string>dict</string>
<string>line</string>
<string>key_list</string>
<string>_write_</string>
<string>container</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>validateBalanceTransaction</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -68,6 +68,8 @@
<value> <string encoding="cdata"><![CDATA[
"""Validates the transaction for both source and destination section.\n
\n
XXX why proxy role ???\n
"""\n
\n
from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
......
......@@ -66,6 +66,8 @@
<item>
<key> <string>_body</string> </key>
<value> <string>"""Validate Transaction Lines for source and destination section.\n
\n
XXX why proxy role ???\n
"""\n
\n
from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
......
......@@ -44,6 +44,12 @@
</tuple>
</value>
</item>
<item>
<key> <string>type_list</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
......
......@@ -15,6 +15,10 @@
<none/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>deleted</string> </value>
......@@ -25,6 +29,22 @@
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>transitions</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>type_list</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
......
......@@ -37,7 +37,6 @@
<key> <string>transitions</string> </key>
<value>
<tuple>
<string>balance_action</string>
<string>cancel</string>
<string>cancel_action</string>
<string>confirm</string>
......
......@@ -44,23 +44,26 @@
</tuple>
</value>
</item>
<item>
<key> <string>type_list</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Persistence</string>
<string>PersistentMapping</string>
</tuple>
<none/>
<global name="PersistentMapping" module="Persistence.mapping"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_container</string> </key>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
......@@ -90,7 +93,12 @@
<item>
<key> <string>Delete objects</string> </key>
<value>
<tuple/>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="StateDefinition" module="Products.DCWorkflow.States"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Started state is a state where the user can modify the transaction, then go back to Stopped state, which will check transaction validity.</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>started</string> </value>
</item>
<item>
<key> <string>permission_roles</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Modifable</string> </value>
</item>
<item>
<key> <string>transitions</string> </key>
<value>
<tuple>
<string>stop</string>
<string>stop_action</string>
</tuple>
</value>
</item>
<item>
<key> <string>type_list</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<global name="PersistentMapping" module="Persistence.mapping"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>Access contents information</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>Add portal content</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Associate</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>Delete objects</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Associate</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>Modify portal content</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Associate</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>View</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -17,7 +17,7 @@
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
<value> <string>Stopped state is a state where the transaction can no longer be modified, but the user can still go back to start state to modify again.</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......@@ -37,11 +37,12 @@
<key> <string>transitions</string> </key>
<value>
<tuple>
<string>balance_action</string>
<string>cancel</string>
<string>cancel_action</string>
<string>deliver</string>
<string>deliver_action</string>
<string>restart_action</string>
<string>start</string>
</tuple>
</value>
</item>
......@@ -57,17 +58,14 @@
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Persistence</string>
<string>PersistentMapping</string>
</tuple>
<none/>
<global name="PersistentMapping" module="Persistence.mapping"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_container</string> </key>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
......@@ -86,8 +84,6 @@
<key> <string>Add portal content</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
......@@ -95,15 +91,15 @@
<item>
<key> <string>Delete objects</string> </key>
<value>
<tuple/>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>Modify portal content</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
</tuple>
</value>
......
......@@ -67,51 +67,22 @@
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Products.DCWorkflow.Guard</string>
<string>Guard</string>
</tuple>
<none/>
<global name="Guard" module="Products.DCWorkflow.Guard"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>roles</string> </key>
<value>
<tuple>
<string>Assignor</string>
<string>Assignee</string>
<string></string>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<tuple>
<tuple>
<string>Products.CMFCore.Expression</string>
<string>Expression</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python: here.getPortalType() != \'Balance Transaction\'</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -67,21 +67,12 @@
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Products.DCWorkflow.Guard</string>
<string>Guard</string>
</tuple>
<none/>
<global name="Guard" module="Products.DCWorkflow.Guard"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>roles</string> </key>
<value>
......@@ -95,23 +86,4 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<tuple>
<tuple>
<string>Products.CMFCore.Expression</string>
<string>Expression</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python: here.getPortalType() != \'Balance Transaction\'</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -21,23 +21,19 @@
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string>Define Account Balance</string> </value>
<value> <string>Modify Transaction</string> </value>
</item>
<item>
<key> <string>actbox_url</string> </key>
<value> <string encoding="cdata"><![CDATA[
%(content_url)s/Base_viewWorkflowActionDialog?workflow_action=balance_action&button_title=Define+Account+Balance
]]></string> </value>
<value> <string>%(content_url)s/Base_viewWorkflowActionDialog?workflow_action=restart_action</string> </value>
</item>
<item>
<key> <string>after_script_name</string> </key>
<value> <string>setReferences</string> </value>
<value> <string>start</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>This user actions should only be used to set up the balanche of all accounts when a company migrates to ERP5 from another ERP</string> </value>
<value> <string></string> </value>
</item>
<item>
<key> <string>guard</string> </key>
......@@ -47,19 +43,19 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>balance_action</string> </value>
<value> <string>restart_action</string> </value>
</item>
<item>
<key> <string>new_state_id</string> </key>
<value> <string>delivered</string> </value>
<value> <string></string> </value>
</item>
<item>
<key> <string>script_name</string> </key>
<value> <string>validateBalanceTransaction</string> </value>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Define Account Balance</string> </value>
<value> <string></string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
......@@ -71,25 +67,17 @@
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<tuple>
<tuple>
<string>Products.DCWorkflow.Guard</string>
<string>Guard</string>
</tuple>
<none/>
<global name="Guard" module="Products.DCWorkflow.Guard"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>roles</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
</tuple>
</value>
......@@ -97,23 +85,4 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<tuple>
<tuple>
<string>Products.CMFCore.Expression</string>
<string>Expression</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python: here.getPortalType() == \'Balance Transaction\'</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="TransitionDefinition" module="Products.DCWorkflow.Transitions"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>after_script_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>guard</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>start</string> </value>
</item>
<item>
<key> <string>new_state_id</string> </key>
<value> <string>started</string> </value>
</item>
<item>
<key> <string>script_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
<value> <int>2</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
552
\ No newline at end of file
554
\ 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