Commit 6c345360 authored by Rafael Monnerat's avatar Rafael Monnerat

Configure Simulation Related Alarms

Initial code is almost the same as the one provided by erp5_simulation_test
in order to preserver initial compatibility
parent 088061a5
<?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>"""\n
This script were copied from erp5_simulation_test, and it must be\n
improved/adapted for configurator purpose.\n
"""\n
\n
# This script is a sample of alarm script that invokes builders.\n
# You may need to modify builder ID\'s according to your application.\n
\n
portal = context.getPortalObject()\n
delivery_tool = portal.portal_deliveries\n
\n
builder_id_list = (\n
\'purchase_invoice_builder\',\n
\'purchase_invoice_transaction_trade_model_builder\',\n
\'purchase_invoice_transaction_builder\',\n
\'sale_invoice_builder\',\n
\'sale_invoice_transaction_trade_model_builder\',\n
\'sale_invoice_transaction_builder\',\n
)\n
\n
for builder_id in builder_id_list:\n
builder = getattr(delivery_tool, builder_id, None)\n
if builder is None:\n
continue\n
delivery_portal_type = builder.getDeliveryPortalType()\n
serialization_tag = \'build:%s\' % delivery_portal_type\n
index_tag = \'index:%s\' % delivery_portal_type\n
after_tag = index_tag\n
after_method_id = (\'recursiveImmediateReindexObject\',\n
\'immediateReindexObject\',\n
\'Delivery_updateAppliedRule\')\n
activate_kw = dict(tag=index_tag)\n
builder.activate(\n
serialization_tag=serialization_tag,\n
after_tag=after_tag,\n
after_method_id=after_method_id).build(activate_kw=activate_kw)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Alarm_buildConfiguratorStandardInvoice</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>"""\n
This script were copied from erp5_simulation_test, and it must be\n
improved/adapted for configurator purpose.\n
"""\n
\n
# This script is a sample of alarm script that invokes builders.\n
# You may need to modify builder ID\'s according to your application.\n
\n
portal = context.getPortalObject()\n
delivery_tool = portal.portal_deliveries\n
\n
builder_id_list = (\n
\'internal_packing_list_builder\',\n
\'sale_packing_list_builder\',\n
\'purchase_packing_list_builder\',\n
)\n
\n
for builder_id in builder_id_list:\n
builder = getattr(delivery_tool, builder_id, None)\n
if builder is None:\n
continue\n
delivery_portal_type = builder.getDeliveryPortalType()\n
serialization_tag = \'build:%s\' % delivery_portal_type\n
index_tag = \'index:%s\' % delivery_portal_type\n
after_tag = index_tag\n
after_method_id = (\'recursiveImmediateReindexObject\',\n
\'immediateReindexObject\',\n
\'Delivery_updateAppliedRule\')\n
activate_kw = dict(tag=index_tag)\n
builder.activate(\n
serialization_tag=serialization_tag,\n
after_tag=after_tag,\n
after_method_id=after_method_id).build(activate_kw=activate_kw)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Alarm_buildConfiguratorStandardPackingList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -75,6 +75,23 @@ for rule_dict in rule_simulation_list:\n
id = rule_dict[\'rule_template_id\'],\n
reference = rule_dict[\'reference\'],\n
trade_phase = rule_dict[\'trade_phase\'])\n
\n
# Create alarms to launch builders. \n
configuration_save.addConfigurationItem("Alarm Configurator Item",\n
title="Invoice Builder Alarm",\n
id="invoice_builder_alarm",\n
periodicity_minute_frequency=5,\n
# A clever solution should be provided for the script\n
# bellow\n
active_sense_method_id="Alarm_buildConfiguratorStandardInvoice")\n
\n
configuration_save.addConfigurationItem("Alarm Configurator Item",\n
title="Packing List Builder Alarm",\n
id="packing_list_builder_alarm",\n
periodicity_minute_frequency=5,\n
# A clever solution should be provided for the script\n
# bellow\n
active_sense_method_id="Alarm_buildConfiguratorStandardPackingList")\n
</string> </value>
</item>
<item>
......
635
\ No newline at end of file
637
\ 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