Commit f8e22924 authored by Jérome Perrin's avatar Jérome Perrin

simulation: drop "Split & defer" workflow action

parent d31304ec
Pipeline #9778 failed with stage
in 0 seconds
delivery = state_change['object']
stop_date = state_change.kwargs['stop_date']
start_date = state_change.kwargs['start_date']
listbox = state_change['kwargs'].get('listbox')
split_movement_list = []
if listbox is not None:
for line in listbox:
url = line['listbox_key']
choice = line['choice']
if choice == 'SplitAndDefer':
split_movement_list.append(delivery.restrictedTraverse(url))
delivery.splitAndDefer(split_movement_list=split_movement_list,
start_date=start_date,
stop_date=stop_date,
comment='')
<?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>_params</string> </key>
<value> <string>state_change</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Delivery_callSplitAndDeferTransition</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
delivery = state_change['object']
split_movement_list = state_change['kwargs']['split_movement_list']
start_date = state_change['kwargs']['start_date']
stop_date = state_change['kwargs']['stop_date']
if not len(split_movement_list):
delivery.updateCausalityState()
return
tag = delivery.getPath() + '_split'
for movement in split_movement_list:
delivery.getPortalObject().portal_simulation.solveMovement(
movement, None, 'SplitAndDefer', start_date=start_date,
stop_date=stop_date, activate_kw={'tag':tag})
delivery.activate(after_tag=tag).updateCausalityState()
# Create delivery
explanation_uid_list = []
object_ = delivery
while object_ is not None:
explanation_uid_list.append(object_.getUid())
object_ = object_.getCausalityValue()
previous_tag = None
for delivery_builder in delivery.getBuilderList():
this_builder_tag = '%s_split_%s' % (delivery.getPath(),
delivery_builder.getId())
after_tag = [tag]
if previous_tag:
after_tag.append(previous_tag)
delivery_builder.activate(activity='SQLQueue',
tag=this_builder_tag,
after_tag=after_tag).build(
explanation_uid=explanation_uid_list)
previous_tag = this_builder_tag
<?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>_params</string> </key>
<value> <string>state_change</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Delivery_splitAndDefer</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -34,8 +34,6 @@ ...@@ -34,8 +34,6 @@
<string>solve_automatically</string> <string>solve_automatically</string>
<string>solve_divergence</string> <string>solve_divergence</string>
<string>solve_divergence_action</string> <string>solve_divergence_action</string>
<string>split_and_defer</string>
<string>split_and_defer_action</string>
<string>start_building</string> <string>start_building</string>
</tuple> </tuple>
</value> </value>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="TransitionDefinition" module="Products.DCWorkflow.Transitions"/>
</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>after_script_name</string> </key>
<value> <string>Delivery_splitAndDefer</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>split_and_defer</string> </value>
</item>
<item>
<key> <string>new_state_id</string> </key>
<value> <string>solving</string> </value>
</item>
<item>
<key> <string>script_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Split and Defer</string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
<value> <int>2</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Guard" module="Products.DCWorkflow.Guard"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>Modify portal content</string>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="TransitionDefinition" module="Products.DCWorkflow.Transitions"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string>Split and Defer</string> </value>
</item>
<item>
<key> <string>actbox_url</string> </key>
<value> <string>%(content_url)s/Delivery_viewSplitAndDeferDialog?field_my_workflow_action=split_and_defer_action</string> </value>
</item>
<item>
<key> <string>after_script_name</string> </key>
<value> <string>Delivery_callSplitAndDeferTransition</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Keep the current Packing List and create a new one with the difference between prevision and current</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>split_and_defer_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>Split and Defer Action</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>
<global name="Guard" module="Products.DCWorkflow.Guard"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>expr</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>roles</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Manager</string>
</tuple>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python:here.getSimulationState() not in here.getPortalDraftOrderStateList() and here.Delivery_isSplitAndDeferPossible()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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