Commit a60dd069 authored by Julien Muchembled's avatar Julien Muchembled

Fix a few places that could create duplicate root applied rules

This commit does some refactoring to reuse Delivery_updateSimulation.
See also e795d8d1
parent 91de33a4
...@@ -50,24 +50,7 @@ ...@@ -50,24 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>invoice = state_change[\'object\']\n <value> <string>state_change[\'object\'].Delivery_updateSimulation()\n
invoice_path = invoice.getPath()\n
path_and_method_id = (invoice_path, (\'immediateReindexObject\',\'recursiveImmediateReindexObject\'))\n
expand_tag = invoice_path + \'_expand\'\n
tag = invoice_path + \'_updateAppliedRule\'\n
\n
priority = 3\n
\n
activate_kw = { \n
\'tag\': expand_tag,\n
\'priority\': priority,\n
}\n
invoice.activate(\n
after_path_and_method_id=path_and_method_id,\n
after_tag=expand_tag,\n
tag=tag,\n
priority=priority,\n
).Delivery_updateAppliedRule(activate_kw=activate_kw)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
103 104
\ No newline at end of file \ No newline at end of file
...@@ -50,42 +50,7 @@ ...@@ -50,42 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>packing_list = state_change[\'object\']\n <value> <string>state_change[\'object\'].Delivery_updateSimulation()\n
\n
activate_kw = {}\n
related_order = packing_list.getCausalityValue()\n
path = packing_list.getPath()\n
tag = \'%s_updateAppliedRule\' % path\n
expand_tag = \'%s_expand\' % path\n
path_and_method_id = (path, (\'immediateReindexObject\',\'recursiveImmediateReindexObject\'))\n
activate_kw = {\'tag\':expand_tag,\'priority\':3}\n
after_tag_list = [expand_tag]\n
if related_order is not None:\n
related_order_path = related_order.getPath()\n
after_tag_list.append(\'%s_expand\' % related_order_path)\n
after_tag_list.append(\'%s_updateAppliedRule\' % related_order_path)\n
\n
packing_list.activate(after_tag=after_tag_list,\n
tag=tag,\n
after_path_and_method_id=path_and_method_id,\n
priority=3).Delivery_updateAppliedRule(activate_kw=activate_kw)\n
\n
\n
# Make sure to reindex related simulation movement if we are already\n
# simulated, call reindexObject, not immediateReindexObject so that\n
# catalogObjectList will be called with many objects\n
# XXX is it really required?\n
packing_list.activate(after_tag=after_tag_list,\n
tag=tag,\n
after_path_and_method_id=path_and_method_id,\n
priority=3).applyToDeliveryRelatedMovement(method_id=\'reindexObject\')\n
\n
if packing_list.getCausalityState() == \'draft\':\n
packing_list.startBuilding()\n
# XXX is it really required?\n
packing_list.activate(\n
after_tag = tag,\n
).updateCausalityState()\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
...@@ -50,34 +50,10 @@ ...@@ -50,34 +50,10 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string>delivery = state_change[\'object\'].getParentValue()\n
if delivery.isDelivery:\n
delivery = state_change[\'object\'].getParentValue()\n delivery.Delivery_updateSimulation()\n
if not delivery.isDelivery:\n </string> </value>
# update simulation from delivery\n
return\n
\n
# copy&paste from delivery_movement_simulation_interaction_workflow/scripts/DeliveryMovement_updateSimulation\n
delivery_path = delivery.getPath()\n
path_and_method_id = (delivery_path, (\'immediateReindexObject\',\'recursiveImmediateReindexObject\'))\n
expand_tag = delivery_path + \'_expand\'\n
tag = delivery_path + \'_updateAppliedRule\'\n
\n
priority = 3\n
\n
activate_kw = { \n
\'tag\': expand_tag,\n
\'priority\': priority,\n
}\n
delivery.activate(\n
after_path_and_method_id=path_and_method_id,\n
after_tag=expand_tag,\n
tag=tag,\n
priority=priority,\n
).Delivery_updateAppliedRule(activate_kw=activate_kw)\n
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
......
1148 1149
\ 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