From 6b7cf491b68e9d09c7d40bbdab777a82bd93335f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Mon, 26 Aug 2013 11:53:26 +0200 Subject: [PATCH] Copy base unit price on movement --- .../Movement_getBaseUnitPrice.xml | 100 ++++++++++++++++++ .../scripts/Movement_setBaseUnitPrice.xml | 79 ++++++++++++++ product/ERP5/bootstrap/erp5_core/bt/revision | 2 +- 3 files changed, 180 insertions(+), 1 deletion(-) create mode 100644 product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/pricing_interaction_workflow/interactions/Movement_getBaseUnitPrice.xml create mode 100644 product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/pricing_interaction_workflow/scripts/Movement_setBaseUnitPrice.xml diff --git a/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/pricing_interaction_workflow/interactions/Movement_getBaseUnitPrice.xml b/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/pricing_interaction_workflow/interactions/Movement_getBaseUnitPrice.xml new file mode 100644 index 0000000000..7a01c02b64 --- /dev/null +++ b/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/pricing_interaction_workflow/interactions/Movement_getBaseUnitPrice.xml @@ -0,0 +1,100 @@ +<?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>Movement_setBaseUnitPrice</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>Set base unit price automatically when getUnitPricePrice is called, if not set yet.</string> </value> + </item> + <item> + <key> <string>guard</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Movement_getBaseUnitPrice</string> </value> + </item> + <item> + <key> <string>method_id</string> </key> + <value> + <list> + <string>getBaseUnitPrice</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> + <none/> + </value> + </item> + <item> + <key> <string>portal_type_group_filter</string> </key> + <value> + <none/> + </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/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/pricing_interaction_workflow/scripts/Movement_setBaseUnitPrice.xml b/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/pricing_interaction_workflow/scripts/Movement_setBaseUnitPrice.xml new file mode 100644 index 0000000000..bcea286c58 --- /dev/null +++ b/product/ERP5/bootstrap/erp5_core/WorkflowTemplateItem/portal_workflow/pricing_interaction_workflow/scripts/Movement_setBaseUnitPrice.xml @@ -0,0 +1,79 @@ +<?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>movement = state_change[\'object\']\n +if not movement.hasBaseUnitPrice():\n + base_unit_price = state_change[\'kwargs\'][\'workflow_method_result\']\n + if base_unit_price is not None:\n + movement.setBaseUnitPrice(base_unit_price)\n +</string> </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>state_change</string> </value> + </item> + <item> + <key> <string>_proxy_roles</string> </key> + <value> + <tuple> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Movement_setBaseUnitPrice</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/product/ERP5/bootstrap/erp5_core/bt/revision b/product/ERP5/bootstrap/erp5_core/bt/revision index 2aec5dd5b9..d47999e0e6 100644 --- a/product/ERP5/bootstrap/erp5_core/bt/revision +++ b/product/ERP5/bootstrap/erp5_core/bt/revision @@ -1 +1 @@ -41125 \ No newline at end of file +41126 \ No newline at end of file -- 2.30.9