From 793e16ff18bb31489be52f4c8e91dbe908923319 Mon Sep 17 00:00:00 2001 From: Sebastien Robin <seb@nexedi.com> Date: Thu, 10 Apr 2008 09:31:08 +0000 Subject: [PATCH] 2008-04-10 Seb * update permission settings on inventory workflow * add cancel action on invenotry worflow * add worklist for draft inventories * improve Duplicate Inventory constraint git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20407 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../DuplicateInventory.py | 12 +- .../portal_workflow/inventory_workflow.xml | 1 + .../scripts/validateConsistency.xml | 9 ++ .../inventory_workflow/states/cancelled.xml | 118 ++++++++++++++++++ .../inventory_workflow/states/deleted.xml | 18 +-- .../inventory_workflow/states/delivered.xml | 32 +++-- .../inventory_workflow/states/draft.xml | 94 ++++++++++++++ .../inventory_workflow/transitions/cancel.xml | 67 ++++++++++ .../transitions/cancel_action.xml | 89 +++++++++++++ .../transitions/delete_action.xml | 1 + .../inventory_workflow/worklists.xml | 6 + .../worklists/1_draft_inventory_list.xml | 113 +++++++++++++++++ bt5/erp5_trade/bt/revision | 2 +- 13 files changed, 539 insertions(+), 23 deletions(-) create mode 100644 bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/states/cancelled.xml create mode 100644 bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/transitions/cancel.xml create mode 100644 bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/transitions/cancel_action.xml create mode 100644 bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/worklists/1_draft_inventory_list.xml diff --git a/bt5/erp5_trade/ConstraintTemplateItem/DuplicateInventory.py b/bt5/erp5_trade/ConstraintTemplateItem/DuplicateInventory.py index 54ed287e7a..834414679b 100644 --- a/bt5/erp5_trade/ConstraintTemplateItem/DuplicateInventory.py +++ b/bt5/erp5_trade/ConstraintTemplateItem/DuplicateInventory.py @@ -104,12 +104,14 @@ class DuplicateInventory(Constraint): inventory_list = getCurrentInventoryList(resource=resource, variation_text=variation_text, from_date=date, at_date=date, + default_stock_table='inventory_stock', node=node) -# LOG('inventory_list sql src', 0, getCurrentInventoryList(resource=resource, -# variation_text=variation_text, -# from_date=date, at_date=date, -# node=node, src__=1)) -# LOG('len inventory_list',0,len(inventory_list)) + LOG('inventory_list sql src', 0, getCurrentInventoryList(resource=resource, + variation_text=variation_text, + from_date=date, at_date=date, + default_stock_table='inventory_stock', + node=node, src__=1)) + LOG('len inventory_list',0,len(inventory_list)) for inventory in inventory_list: movement = getObjectFromUid(inventory.stock_uid) if movement.getPortalType().find('Inventory') >= 0: diff --git a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow.xml b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow.xml index 2d127a06ab..e4a7c0456d 100644 --- a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow.xml +++ b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow.xml @@ -49,6 +49,7 @@ <string>View</string> <string>Modify portal content</string> <string>Add portal content</string> + <string>Delete objects</string> </tuple> </value> </item> diff --git a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/scripts/validateConsistency.xml b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/scripts/validateConsistency.xml index 408b34620d..a8bfd4b86f 100644 --- a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/scripts/validateConsistency.xml +++ b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/scripts/validateConsistency.xml @@ -86,6 +86,13 @@ if node is None:\n message = Message(domain=\'ui\', message=text)\n raise ValidationFailed, message\n \n +for line in inventory.getMovementList():\n + if line.getResource() is None:\n + text = "Sorry, no resource for line $line_title"\n + message = Message(domain=\'ui\', message=text,\n + mapping={\'line_title\': line.getTitle()})\n + raise ValidationFailed, message\n +\n \n # use of the constraint\n error_list = inventory.checkConsistency()\n @@ -149,6 +156,8 @@ if len(error_list) > 0:\n <string>text</string> <string>message</string> <string>node</string> + <string>_getiter_</string> + <string>line</string> <string>error_list</string> <string>len</string> </tuple> diff --git a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/states/cancelled.xml b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/states/cancelled.xml new file mode 100644 index 0000000000..c4245f029a --- /dev/null +++ b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/states/cancelled.xml @@ -0,0 +1,118 @@ +<?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></string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>cancelled</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>Cancelled</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> + <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> + <list> + <string>Assignee</string> + <string>Assignor</string> + <string>Associate</string> + <string>Auditor</string> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>Add portal content</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>Delete objects</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>Modify portal content</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>View</string> </key> + <value> + <list> + <string>Assignee</string> + <string>Assignor</string> + <string>Associate</string> + <string>Auditor</string> + <string>Manager</string> + </list> + </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/states/deleted.xml b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/states/deleted.xml index 6a1e1ce0ff..3bfdbf5fe8 100644 --- a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/states/deleted.xml +++ b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/states/deleted.xml @@ -72,25 +72,25 @@ <item> <key> <string>Add portal content</string> </key> <value> - <tuple> - <string>Manager</string> - </tuple> + <tuple/> + </value> + </item> + <item> + <key> <string>Delete objects</string> </key> + <value> + <tuple/> </value> </item> <item> <key> <string>Modify portal content</string> </key> <value> - <tuple> - <string>Manager</string> - </tuple> + <tuple/> </value> </item> <item> <key> <string>View</string> </key> <value> - <tuple> - <string>Manager</string> - </tuple> + <tuple/> </value> </item> </dictionary> diff --git a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/states/delivered.xml b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/states/delivered.xml index 7ec204a0a5..26c05e8874 100644 --- a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/states/delivered.xml +++ b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/states/delivered.xml @@ -51,23 +51,26 @@ <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> <key> <string>Access contents information</string> </key> <value> - <list/> + <tuple> + <string>Assignee</string> + <string>Assignor</string> + <string>Associate</string> + <string>Auditor</string> + <string>Manager</string> + </tuple> </value> </item> <item> @@ -78,6 +81,14 @@ </tuple> </value> </item> + <item> + <key> <string>Delete objects</string> </key> + <value> + <tuple> + <string>Manager</string> + </tuple> + </value> + </item> <item> <key> <string>Modify portal content</string> </key> <value> @@ -89,7 +100,12 @@ <item> <key> <string>View</string> </key> <value> - <list/> + <tuple> + <string>Assignee</string> + <string>Assignor</string> + <string>Auditor</string> + <string>Manager</string> + </tuple> </value> </item> </dictionary> diff --git a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/states/draft.xml b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/states/draft.xml index f77c189ea7..317dff946b 100644 --- a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/states/draft.xml +++ b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/states/draft.xml @@ -23,6 +23,12 @@ <key> <string>id</string> </key> <value> <string>draft</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>Draft</string> </value> @@ -31,6 +37,8 @@ <key> <string>transitions</string> </key> <value> <tuple> + <string>cancel</string> + <string>cancel_action</string> <string>delete</string> <string>delete_action</string> <string>deliver</string> @@ -47,4 +55,90 @@ </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>Assignee</string> + <string>Assignor</string> + <string>Associate</string> + <string>Auditor</string> + <string>Author</string> + <string>Manager</string> + <string>Owner</string> + </tuple> + </value> + </item> + <item> + <key> <string>Add portal content</string> </key> + <value> + <tuple> + <string>Assignee</string> + <string>Assignor</string> + <string>Associate</string> + <string>Author</string> + <string>Manager</string> + <string>Owner</string> + </tuple> + </value> + </item> + <item> + <key> <string>Delete objects</string> </key> + <value> + <tuple> + <string>Assignee</string> + <string>Assignor</string> + <string>Associate</string> + <string>Author</string> + <string>Manager</string> + <string>Owner</string> + </tuple> + </value> + </item> + <item> + <key> <string>Modify portal content</string> </key> + <value> + <tuple> + <string>Assignee</string> + <string>Assignor</string> + <string>Associate</string> + <string>Author</string> + <string>Manager</string> + <string>Owner</string> + </tuple> + </value> + </item> + <item> + <key> <string>View</string> </key> + <value> + <tuple> + <string>Assignee</string> + <string>Assignor</string> + <string>Associate</string> + <string>Auditor</string> + <string>Author</string> + <string>Manager</string> + <string>Owner</string> + </tuple> + </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> </ZopeData> diff --git a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/transitions/cancel.xml b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/transitions/cancel.xml new file mode 100644 index 0000000000..7e6c616311 --- /dev/null +++ b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/transitions/cancel.xml @@ -0,0 +1,67 @@ +<?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>cancel</string> </value> + </item> + <item> + <key> <string>new_state_id</string> </key> + <value> <string>cancelled</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> diff --git a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/transitions/cancel_action.xml b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/transitions/cancel_action.xml new file mode 100644 index 0000000000..aa896c4533 --- /dev/null +++ b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/transitions/cancel_action.xml @@ -0,0 +1,89 @@ +<?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>Cancel Inventory</string> </value> + </item> + <item> + <key> <string>actbox_url</string> </key> + <value> <string>%(content_url)s/BaseWorkflow_viewWorkflowActionDialog?workflow_action=cancel_action</string> </value> + </item> + <item> + <key> <string>after_script_name</string> </key> + <value> <string>cancel</string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>guard</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>cancel_action</string> </value> + </item> + <item> + <key> <string>new_state_id</string> </key> + <value> <string></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>1</int> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <tuple> + <global name="Guard" module="Products.DCWorkflow.Guard"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>roles</string> </key> + <value> + <tuple> + <string>Assignor</string> + <string>Assignee</string> + <string>Manager</string> + </tuple> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/transitions/delete_action.xml b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/transitions/delete_action.xml index 0ccb72e7b9..f0fd3acae7 100644 --- a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/transitions/delete_action.xml +++ b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/transitions/delete_action.xml @@ -78,6 +78,7 @@ <value> <tuple> <string>Assignee</string> + <string>Assignor</string> <string>Manager</string> </tuple> </value> diff --git a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/worklists.xml b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/worklists.xml index 3953ad0209..609a885c76 100644 --- a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/worklists.xml +++ b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/worklists.xml @@ -21,6 +21,12 @@ <dictionary/> </value> </item> + <item> + <key> <string>_objects</string> </key> + <value> + <tuple/> + </value> + </item> <item> <key> <string>id</string> </key> <value> <string>worklists</string> </value> diff --git a/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/worklists/1_draft_inventory_list.xml b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/worklists/1_draft_inventory_list.xml new file mode 100644 index 0000000000..ac08c711fd --- /dev/null +++ b/bt5/erp5_trade/WorkflowTemplateItem/portal_workflow/inventory_workflow/worklists/1_draft_inventory_list.xml @@ -0,0 +1,113 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <tuple> + <global name="WorklistDefinition" module="Products.DCWorkflow.Worklists"/> + <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>global</string> </value> + </item> + <item> + <key> <string>actbox_name</string> </key> + <value> <string>Inventories to validate (%(count)s)</string> </value> + </item> + <item> + <key> <string>actbox_url</string> </key> + <value> <string encoding="cdata"><![CDATA[ + +inventory_module/view?simulation_state=draft&local_roles:list=Assignee&local_roles:list=Assignor&reset=1 + +]]></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string>Inventories to validate</string> </value> + </item> + <item> + <key> <string>guard</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>1_draft_inventory_list</string> </value> + </item> + <item> + <key> <string>var_matches</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <tuple> + <global name="Guard" module="Products.DCWorkflow.Guard"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>roles</string> </key> + <value> + <tuple> + <string>Assignee</string> + <string>Assignor</string> + </tuple> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <tuple> + <global name="PersistentMapping" module="Persistence.mapping"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>data</string> </key> + <value> + <dictionary> + <item> + <key> <string>portal_type</string> </key> + <value> + <tuple> + <string>Inventory</string> + </tuple> + </value> + </item> + <item> + <key> <string>simulation_state</string> </key> + <value> + <tuple> + <string>draft</string> + </tuple> + </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/erp5_trade/bt/revision b/bt5/erp5_trade/bt/revision index dcb6b5baa1..565f1b06a1 100644 --- a/bt5/erp5_trade/bt/revision +++ b/bt5/erp5_trade/bt/revision @@ -1 +1 @@ -230 +231 \ No newline at end of file -- 2.30.9