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 @@ ...@@ -49,6 +49,7 @@
<string>View</string> <string>View</string>
<string>Access contents information</string> <string>Access contents information</string>
<string>Add portal content</string> <string>Add portal content</string>
<string>Delete objects</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -65,7 +65,10 @@ ...@@ -65,7 +65,10 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <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 \n
# Get sections.\n # Get sections.\n
source_section = transaction.getSourceSection()\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 @@ ...@@ -68,6 +68,8 @@
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
"""Validates the transaction for both source and destination section.\n """Validates the transaction for both source and destination section.\n
\n
XXX why proxy role ???\n
"""\n """\n
\n \n
from Products.DCWorkflow.DCWorkflow import ValidationFailed\n from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
......
...@@ -66,6 +66,8 @@ ...@@ -66,6 +66,8 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>"""Validate Transaction Lines for source and destination section.\n <value> <string>"""Validate Transaction Lines for source and destination section.\n
\n
XXX why proxy role ???\n
"""\n """\n
\n \n
from Products.DCWorkflow.DCWorkflow import ValidationFailed\n from Products.DCWorkflow.DCWorkflow import ValidationFailed\n
......
...@@ -44,6 +44,12 @@ ...@@ -44,6 +44,12 @@
</tuple> </tuple>
</value> </value>
</item> </item>
<item>
<key> <string>type_list</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
......
...@@ -15,6 +15,10 @@ ...@@ -15,6 +15,10 @@
<none/> <none/>
</value> </value>
</item> </item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>deleted</string> </value> <value> <string>deleted</string> </value>
...@@ -25,6 +29,22 @@ ...@@ -25,6 +29,22 @@
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
</item> </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> </dictionary>
</pickle> </pickle>
</record> </record>
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
<key> <string>transitions</string> </key> <key> <string>transitions</string> </key>
<value> <value>
<tuple> <tuple>
<string>balance_action</string>
<string>cancel</string> <string>cancel</string>
<string>cancel_action</string> <string>cancel_action</string>
<string>confirm</string> <string>confirm</string>
......
...@@ -44,23 +44,26 @@ ...@@ -44,23 +44,26 @@
</tuple> </tuple>
</value> </value>
</item> </item>
<item>
<key> <string>type_list</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <record id="2" aka="AAAAAAAAAAI=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="PersistentMapping" module="Persistence.mapping"/>
<string>Persistence</string> <tuple/>
<string>PersistentMapping</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>_container</string> </key> <key> <string>data</string> </key>
<value> <value>
<dictionary> <dictionary>
<item> <item>
...@@ -90,7 +93,12 @@ ...@@ -90,7 +93,12 @@
<item> <item>
<key> <string>Delete objects</string> </key> <key> <string>Delete objects</string> </key>
<value> <value>
<tuple/> <tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value> </value>
</item> </item>
<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 @@ ...@@ -17,7 +17,7 @@
</item> </item>
<item> <item>
<key> <string>description</string> </key> <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>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
...@@ -37,11 +37,12 @@ ...@@ -37,11 +37,12 @@
<key> <string>transitions</string> </key> <key> <string>transitions</string> </key>
<value> <value>
<tuple> <tuple>
<string>balance_action</string>
<string>cancel</string> <string>cancel</string>
<string>cancel_action</string> <string>cancel_action</string>
<string>deliver</string> <string>deliver</string>
<string>deliver_action</string> <string>deliver_action</string>
<string>restart_action</string>
<string>start</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -57,17 +58,14 @@ ...@@ -57,17 +58,14 @@
<record id="2" aka="AAAAAAAAAAI="> <record id="2" aka="AAAAAAAAAAI=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="PersistentMapping" module="Persistence.mapping"/>
<string>Persistence</string> <tuple/>
<string>PersistentMapping</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>_container</string> </key> <key> <string>data</string> </key>
<value> <value>
<dictionary> <dictionary>
<item> <item>
...@@ -86,8 +84,6 @@ ...@@ -86,8 +84,6 @@
<key> <string>Add portal content</string> </key> <key> <string>Add portal content</string> </key>
<value> <value>
<tuple> <tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string> <string>Manager</string>
</tuple> </tuple>
</value> </value>
...@@ -95,15 +91,15 @@ ...@@ -95,15 +91,15 @@
<item> <item>
<key> <string>Delete objects</string> </key> <key> <string>Delete objects</string> </key>
<value> <value>
<tuple/> <tuple>
<string>Manager</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
<key> <string>Modify portal content</string> </key> <key> <string>Modify portal content</string> </key>
<value> <value>
<tuple> <tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Manager</string> <string>Manager</string>
</tuple> </tuple>
</value> </value>
......
...@@ -67,51 +67,22 @@ ...@@ -67,51 +67,22 @@
<record id="2" aka="AAAAAAAAAAI="> <record id="2" aka="AAAAAAAAAAI=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="Guard" module="Products.DCWorkflow.Guard"/>
<string>Products.DCWorkflow.Guard</string> <tuple/>
<string>Guard</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>roles</string> </key> <key> <string>roles</string> </key>
<value> <value>
<tuple> <tuple>
<string>Assignor</string> <string>Assignor</string>
<string>Assignee</string> <string>Assignee</string>
<string></string>
</tuple> </tuple>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </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> </ZopeData>
...@@ -67,21 +67,12 @@ ...@@ -67,21 +67,12 @@
<record id="2" aka="AAAAAAAAAAI="> <record id="2" aka="AAAAAAAAAAI=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="Guard" module="Products.DCWorkflow.Guard"/>
<string>Products.DCWorkflow.Guard</string> <tuple/>
<string>Guard</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>roles</string> </key> <key> <string>roles</string> </key>
<value> <value>
...@@ -95,23 +86,4 @@ ...@@ -95,23 +86,4 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </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> </ZopeData>
...@@ -21,23 +21,19 @@ ...@@ -21,23 +21,19 @@
</item> </item>
<item> <item>
<key> <string>actbox_name</string> </key> <key> <string>actbox_name</string> </key>
<value> <string>Define Account Balance</string> </value> <value> <string>Modify Transaction</string> </value>
</item> </item>
<item> <item>
<key> <string>actbox_url</string> </key> <key> <string>actbox_url</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string>%(content_url)s/Base_viewWorkflowActionDialog?workflow_action=restart_action</string> </value>
%(content_url)s/Base_viewWorkflowActionDialog?workflow_action=balance_action&button_title=Define+Account+Balance
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>after_script_name</string> </key> <key> <string>after_script_name</string> </key>
<value> <string>setReferences</string> </value> <value> <string>start</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <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>
<item> <item>
<key> <string>guard</string> </key> <key> <string>guard</string> </key>
...@@ -47,19 +43,19 @@ ...@@ -47,19 +43,19 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>balance_action</string> </value> <value> <string>restart_action</string> </value>
</item> </item>
<item> <item>
<key> <string>new_state_id</string> </key> <key> <string>new_state_id</string> </key>
<value> <string>delivered</string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>script_name</string> </key> <key> <string>script_name</string> </key>
<value> <string>validateBalanceTransaction</string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Define Account Balance</string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>trigger_type</string> </key> <key> <string>trigger_type</string> </key>
...@@ -71,25 +67,17 @@ ...@@ -71,25 +67,17 @@
<record id="2" aka="AAAAAAAAAAI="> <record id="2" aka="AAAAAAAAAAI=">
<pickle> <pickle>
<tuple> <tuple>
<tuple> <global name="Guard" module="Products.DCWorkflow.Guard"/>
<string>Products.DCWorkflow.Guard</string> <tuple/>
<string>Guard</string>
</tuple>
<none/>
</tuple> </tuple>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>roles</string> </key> <key> <string>roles</string> </key>
<value> <value>
<tuple> <tuple>
<string>Assignee</string>
<string>Assignor</string> <string>Assignor</string>
</tuple> </tuple>
</value> </value>
...@@ -97,23 +85,4 @@ ...@@ -97,23 +85,4 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </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> </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 554
\ 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