Commit 74a6fdd5 authored by Romain Courteaud's avatar Romain Courteaud

Moved to person_slap_interface_workflow

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42373 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2a241f1a
<?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>
<list>
<string>Delivery_assertSubscriptionItem</string>
</list>
</value>
</item>
<item>
<key> <string>after_script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>before_commit_script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>If the resource of the order line allows Subscription Items, then create it.</string> </value>
</item>
<item>
<key> <string>guard</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>assert_subscription</string> </value>
</item>
<item>
<key> <string>method_id</string> </key>
<value>
<list>
<string>order</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>Sale Order</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>1</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Create if needed a subscription Item</string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
<value> <int>2</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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_createEmptySoftwareInstance</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>create_software_instance</string> </value>
</item>
<item>
<key> <string>method_id</string> </key>
<value>
<list>
<string>order</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>Sale Order</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>1</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>
...@@ -69,8 +69,6 @@ if custom_trade_condition is None:\n ...@@ -69,8 +69,6 @@ if custom_trade_condition is None:\n
validation_state="validated")\n validation_state="validated")\n
if len(trade_condition_list):\n if len(trade_condition_list):\n
custom_trade_condition = trade_condition_list[0].getObject()\n custom_trade_condition = trade_condition_list[0].getObject()\n
else:\n
log(repr(custom_trade_condition.getRelativeUrl()))\n
\n \n
if custom_trade_condition is None:\n if custom_trade_condition is None:\n
# nothing found then create a new custom trade condition\n # nothing found then create a new custom trade condition\n
...@@ -84,32 +82,6 @@ else:\n ...@@ -84,32 +82,6 @@ else:\n
log(repr(custom_trade_condition.getRelativeUrl()))\n log(repr(custom_trade_condition.getRelativeUrl()))\n
\n \n
order.setSpecialiseValue(custom_trade_condition, portal_type="Sale Trade Condition")\n order.setSpecialiseValue(custom_trade_condition, portal_type="Sale Trade Condition")\n
log(repr(custom_trade_condition.getRelativeUrl()))\n
log(repr(order.getSpecialise()))\n
\n
### STEP 2: does this order have a client-specific Open Order\n
open_order_list = portal.open_sale_order_module.searchFolder(destination_section_uid=order.getDestinationSectionUid(),\n
simulation_state="started")\n
if not len(open_order_list):\n
# Maybe the Open Order has not been indexed yet. Fortunately we have a workflow on Person for that. We check its state,\n
# and if Person is in a open_order_created state, we fetch its linked Open Order. Else, we create the Open Order and change this state.\n
person = order.getDestinationSectionValue()\n
person_slap_interface_state = person.getSlapState()\n
if person_slap_interface_state in \'open_order_created\':\n
open_order_url = context.portal_workflow.getInfoFor(ob=person, name=\'open_order_url\', wf_id=\'person_slap_interface_workflow\')\n
open_order = portal.restrictedTraverse(open_order_url)\n
else:\n
open_order = portal.open_sale_order_module.newContent(\n
destination_section_uid=order.getDestinationSectionUid(),\n
destination_decision_uid=order.getDestinationDecisionUid(),\n
title="ViFiB Open Order")\n
person.createOpenOrder(open_order_url=open_order.getRelativeUrl())\n
open_order.order()\n
open_order.start()\n
else:\n
open_order = open_order_list[0]\n
\n
return open_order\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -160,12 +132,6 @@ return open_order\n ...@@ -160,12 +132,6 @@ return open_order\n
<string>trade_condition_list</string> <string>trade_condition_list</string>
<string>len</string> <string>len</string>
<string>repr</string> <string>repr</string>
<string>open_order_list</string>
<string>person</string>
<string>person_slap_interface_state</string>
<string>context</string>
<string>open_order_url</string>
<string>open_order</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
<?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>order = state_change[\'object\']\n
portal = order.getPortalObject()\n
\n
setup_service_relative_url = order.portal_preferences.getPreferredInstanceSetupResource()\n
open_order = context.Delivery_assertCustomTradeConditionAndOpenOrder(state_change)\n
\n
for order_line in order.getMovementList():\n
if order_line.getResource() == setup_service_relative_url:\n
subscription = order_line.getAggregateValue(portal_type="Hosting Subscription")\n
if subscription is None:\n
subscription = portal.getDefaultModule(portal_type="Hosting Subscription").newContent(\n
portal_type="Hosting Subscription",\n
title=order_line.getTitle())\n
order_line.edit(\n
aggregate_list=order_line.getAggregateList()+[subscription.getRelativeUrl()])\n
open_order.newContent(\n
portal_type="Open Sale Order Line",\n
title=order_line.getAggregateTitle(portal_type="Software Release"),\n
aggregate=subscription.getRelativeUrl())\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>_getitem_</string>
<string>order</string>
<string>_getattr_</string>
<string>portal</string>
<string>setup_service_relative_url</string>
<string>context</string>
<string>open_order</string>
<string>_getiter_</string>
<string>order_line</string>
<string>subscription</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_assertSubscriptionItem</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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 encoding="cdata"><![CDATA[
order = state_change[\'object\']\n
portal = order.getPortalObject()\n
\n
setup_service_relative_url = order.portal_preferences.getPreferredInstanceSetupResource()\n
isTransitionPossible = portal.portal_workflow.isTransitionPossible\n
\n
for order_line in order.getMovementList():\n
if order_line.getResource() == setup_service_relative_url:\n
software_instance = order_line.getAggregateValue(portal_type="Software Instance")\n
if software_instance is None:\n
software_instance = portal.getDefaultModule(portal_type="Software Instance").newContent(\n
portal_type="Software Instance",\n
reference="XXX",\n
title="XXX",\n
text_content="""<?xml version="1.0" encoding="utf-8"?>\n
<instance>\n
</instance>\n
""")\n
\n
order_line.edit(\n
aggregate_list=order_line.getAggregateList()+[software_instance.getRelativeUrl()])\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>_getitem_</string>
<string>order</string>
<string>_getattr_</string>
<string>portal</string>
<string>setup_service_relative_url</string>
<string>isTransitionPossible</string>
<string>_getiter_</string>
<string>order_line</string>
<string>software_instance</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_createEmptySoftwareInstance</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
67 68
\ 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