From 7f449f573dc2a7f92659a20c36d79ee052393229 Mon Sep 17 00:00:00 2001 From: Romain Courteaud <romain@nexedi.com> Date: Mon, 3 Jan 2011 12:35:59 +0000 Subject: [PATCH] Set a default purchase trade condition on purchase packing list. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41941 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../vifib_purchase_trade_condition.xml | 146 ++++++++++++++++++ .../workflow_chain_type.xml | 4 + .../assert_purchase_trade_condition.xml | 98 ++++++++++++ ...ery_assertCustomPurchaseTradeCondition.xml | 136 ++++++++++++++++ bt5/vifib_open_trade/bt/revision | 2 +- bt5/vifib_open_trade/bt/template_path_list | 2 + .../template_portal_type_workflow_chain_list | 1 + 7 files changed, 388 insertions(+), 1 deletion(-) create mode 100644 bt5/vifib_open_trade/PathTemplateItem/purchase_trade_condition_module/vifib_purchase_trade_condition.xml create mode 100644 bt5/vifib_open_trade/WorkflowTemplateItem/portal_workflow/vifib_open_order_interaction_workflow/interactions/assert_purchase_trade_condition.xml create mode 100644 bt5/vifib_open_trade/WorkflowTemplateItem/portal_workflow/vifib_open_order_interaction_workflow/scripts/Delivery_assertCustomPurchaseTradeCondition.xml diff --git a/bt5/vifib_open_trade/PathTemplateItem/purchase_trade_condition_module/vifib_purchase_trade_condition.xml b/bt5/vifib_open_trade/PathTemplateItem/purchase_trade_condition_module/vifib_purchase_trade_condition.xml new file mode 100644 index 0000000000..6106c2e4cb --- /dev/null +++ b/bt5/vifib_open_trade/PathTemplateItem/purchase_trade_condition_module/vifib_purchase_trade_condition.xml @@ -0,0 +1,146 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Purchase Trade Condition" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_Access_contents_information_Permission</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_Permission</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_Permission</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_Permission</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>_identity_criterion</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>_range_criterion</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + </value> + </item> + <item> + <key> <string>categories</string> </key> + <value> + <tuple> + <string>specialise/business_process_module/erp5_default_business_process</string> + </tuple> + </value> + </item> + <item> + <key> <string>comment</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>vifib_purchase_trade_condition</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Purchase Trade Condition</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Default Purchase Trade Condition</string> </value> + </item> + <item> + <key> <string>version</string> </key> + <value> + <none/> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="PersistentMapping" module="Persistence.mapping"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>data</string> </key> + <value> + <dictionary/> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <global name="PersistentMapping" module="Persistence.mapping"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>data</string> </key> + <value> + <dictionary/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/vifib_open_trade/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml b/bt5/vifib_open_trade/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml index 0845203cb1..67d75899be 100644 --- a/bt5/vifib_open_trade/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml +++ b/bt5/vifib_open_trade/PortalTypeWorkflowChainTemplateItem/workflow_chain_type.xml @@ -3,6 +3,10 @@ <type>Hosting Subscription</type> <workflow>edit_workflow, hosting_subscription_workflow</workflow> </chain> + <chain> + <type>Purchase Packing List</type> + <workflow>vifib_open_order_interaction_workflow</workflow> + </chain> <chain> <type>Sale Order</type> <workflow>vifib_open_order_interaction_workflow</workflow> diff --git a/bt5/vifib_open_trade/WorkflowTemplateItem/portal_workflow/vifib_open_order_interaction_workflow/interactions/assert_purchase_trade_condition.xml b/bt5/vifib_open_trade/WorkflowTemplateItem/portal_workflow/vifib_open_order_interaction_workflow/interactions/assert_purchase_trade_condition.xml new file mode 100644 index 0000000000..142c957673 --- /dev/null +++ b/bt5/vifib_open_trade/WorkflowTemplateItem/portal_workflow/vifib_open_order_interaction_workflow/interactions/assert_purchase_trade_condition.xml @@ -0,0 +1,98 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="InteractionDefinition" module="Products.ERP5.Interaction"/> + </pickle> + <pickle> + <dictionary> + <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>activate_script_name</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>after_script_name</string> </key> + <value> + <list> + <string>Delivery_assertCustomPurchaseTradeCondition</string> + </list> + </value> + </item> + <item> + <key> <string>before_commit_script_name</string> </key> + <value> + <tuple/> + </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>assert_purchase_trade_condition</string> </value> + </item> + <item> + <key> <string>method_id</string> </key> + <value> + <list> + <string>order</string> + <string>confirm</string> + <string>plan</string> + </list> + </value> + </item> + <item> + <key> <string>once_per_transaction</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>portal_type_filter</string> </key> + <value> + <list> + <string>Purchase Packing List</string> + </list> + </value> + </item> + <item> + <key> <string>script_name</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>temporary_document_disallowed</string> </key> + <value> <int>0</int> </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/vifib_open_trade/WorkflowTemplateItem/portal_workflow/vifib_open_order_interaction_workflow/scripts/Delivery_assertCustomPurchaseTradeCondition.xml b/bt5/vifib_open_trade/WorkflowTemplateItem/portal_workflow/vifib_open_order_interaction_workflow/scripts/Delivery_assertCustomPurchaseTradeCondition.xml new file mode 100644 index 0000000000..e8e98000e1 --- /dev/null +++ b/bt5/vifib_open_trade/WorkflowTemplateItem/portal_workflow/vifib_open_order_interaction_workflow/scripts/Delivery_assertCustomPurchaseTradeCondition.xml @@ -0,0 +1,136 @@ +<?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>from Products.ERP5Type.Log import log\n +order = state_change[\'object\']\n +portal = order.getPortalObject()\n +\n +### STEP 1: does this order have a client-specific Trade Condition\n +trade_condition = order.getSpecialiseValue(portal_type="Purchase Trade Condition")\n +if trade_condition is None:\n + # nothing found then create a new custom trade condition\n + trade_condition = \'purchase_trade_condition_module/vifib_purchase_trade_condition\'\n + order.edit(specialise=trade_condition)\n +</string> </value> + </item> + <item> + <key> <string>_code</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>state_change, **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>1</int> </value> + </item> + <item> + <key> <string>co_varnames</string> </key> + <value> + <tuple> + <string>state_change</string> + <string>kw</string> + <string>Products.ERP5Type.Log</string> + <string>log</string> + <string>_getitem_</string> + <string>order</string> + <string>_getattr_</string> + <string>portal</string> + <string>trade_condition</string> + <string>None</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>Delivery_assertCustomPurchaseTradeCondition</string> </value> + </item> + <item> + <key> <string>warnings</string> </key> + <value> + <tuple/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/bt5/vifib_open_trade/bt/revision b/bt5/vifib_open_trade/bt/revision index 2b82dfea30..b2412e34df 100644 --- a/bt5/vifib_open_trade/bt/revision +++ b/bt5/vifib_open_trade/bt/revision @@ -1 +1 @@ -60 \ No newline at end of file +62 \ No newline at end of file diff --git a/bt5/vifib_open_trade/bt/template_path_list b/bt5/vifib_open_trade/bt/template_path_list index 16d58ae2c0..5fb4ef36cc 100644 --- a/bt5/vifib_open_trade/bt/template_path_list +++ b/bt5/vifib_open_trade/bt/template_path_list @@ -11,6 +11,8 @@ portal_rules/default_subscription_item_rule portal_rules/default_subscription_item_rule/** purchase_packing_list_module/test_purchase_packing_list purchase_packing_list_module/test_purchase_packing_list/** +purchase_trade_condition_module/vifib_purchase_trade_condition +purchase_trade_condition_module/vifib_purchase_trade_condition/** sale_trade_condition_module/10 sale_trade_condition_module/10/** sale_trade_condition_module/vifib_trade_condition diff --git a/bt5/vifib_open_trade/bt/template_portal_type_workflow_chain_list b/bt5/vifib_open_trade/bt/template_portal_type_workflow_chain_list index b349844c98..9b690a90a3 100644 --- a/bt5/vifib_open_trade/bt/template_portal_type_workflow_chain_list +++ b/bt5/vifib_open_trade/bt/template_portal_type_workflow_chain_list @@ -1,3 +1,4 @@ Hosting Subscription | edit_workflow Hosting Subscription | hosting_subscription_workflow +Purchase Packing List | vifib_open_order_interaction_workflow Sale Order | vifib_open_order_interaction_workflow \ No newline at end of file -- 2.30.9