Commit 92acd9c9 authored by Łukasz Nowak's avatar Łukasz Nowak

Separate divergence checking and solving.

Check divergence (for calculating and building) really often and while checking only move to one of possible states (solved or diverged).

For diverged ones try rarely to solve divergence automatically.
parent f17f728f
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Alarm" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>active_sense_method_id</string> </key>
<value> <string>Alarm_solveAutomatically</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>vifib_solve_automatically</string> </value>
</item>
<item>
<key> <string>periodicity_hour</string> </key>
<value>
<tuple>
<int>0</int>
</tuple>
</value>
</item>
<item>
<key> <string>periodicity_minute</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_minute_frequency</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>periodicity_month</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_month_day</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_start_date</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>608654520.0</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>periodicity_week</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Alarm</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Solves deliveries automatically</string> </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>portal = context.getPortalObject()\n
activate_kw = {\n
\'tag\': tag\n
}\n
portal.portal_catalog.searchAndActivate(\n
portal_type=portal.getPortalDeliveryTypeList(),\n
causality_state=(\'diverged\',),\n
activate_kw=activate_kw,\n
packet_size=1, # Separate calls to many transactions\n
method_id=\'Delivery_solveAutomatically\'\n
)\n
context.activate(after_tag=tag).getId()\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>tag, fixit, params</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Alarm_solveAutomatically</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -58,7 +58,6 @@ portal.portal_catalog.searchAndActivate(\n ...@@ -58,7 +58,6 @@ portal.portal_catalog.searchAndActivate(\n
portal_type=portal.getPortalDeliveryTypeList(),\n portal_type=portal.getPortalDeliveryTypeList(),\n
causality_state=(\'building\', \'calculating\'),\n causality_state=(\'building\', \'calculating\'),\n
activate_kw=activate_kw,\n activate_kw=activate_kw,\n
packet_size=1, # Separate calls to many transactions\n
method_id=\'Delivery_updateCausalityState\'\n method_id=\'Delivery_updateCausalityState\'\n
)\n )\n
context.activate(after_tag=tag).getId()\n context.activate(after_tag=tag).getId()\n
......
<?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>delivery = context\n
if delivery.getCausalityState() not in (\'diverged\',):\n
return\n
path = delivery.getPath()\n
portal_activities = context.getPortalObject().portal_activities\n
if portal_activities.countMessage(path=path) == 0 \\\n
and portal_activities.countMessageWithTag(\'%s_solve\' % path) == 0:\n
delivery.solveAutomatically()\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Delivery_solveAutomatically</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -53,12 +53,11 @@ ...@@ -53,12 +53,11 @@
<value> <string>delivery = context\n <value> <string>delivery = context\n
if delivery.getCausalityState() not in (\'building\', \'calculating\'):\n if delivery.getCausalityState() not in (\'building\', \'calculating\'):\n
return\n return\n
\n
portal_activities = context.getPortalObject().portal_activities\n
path = delivery.getPath()\n path = delivery.getPath()\n
if context.getPortalObject().portal_activities.countMessage(path=path) == 0 \\\n portal_activities = context.getPortalObject().portal_activities\n
if portal_activities.countMessage(path=path) == 0 \\\n
and portal_activities.countMessageWithTag(\'%s_solve\' % path) == 0:\n and portal_activities.countMessageWithTag(\'%s_solve\' % path) == 0:\n
delivery.updateCausalityState()\n delivery.updateCausalityState(solve_automatically=False)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
501 502
\ No newline at end of file \ No newline at end of file
portal_alarms/vifib_expand_confirmed_sale_order portal_alarms/vifib_expand_confirmed_sale_order
portal_alarms/vifib_expand_delivery_line portal_alarms/vifib_expand_delivery_line
portal_alarms/vifib_solve_automatically
portal_alarms/vifib_update_delivery_causality_state portal_alarms/vifib_update_delivery_causality_state
\ 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