Commit 72dae5ec authored by Łukasz Nowak's avatar Łukasz Nowak

Split the alarm.

Also provide test skeleton.
parent 4caa52f2
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>active_sense_method_id</string> </key> <key> <string>active_sense_method_id</string> </key>
<value> <string>Alarm_deliverConfirmedAggregatedDelivery</string> </value> <value> <string>Alarm_deliverConfirmedAggregatedSalePackingList</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>slapos_deliver_confirmed_aggregated_delivery</string> </value> <value> <string>slapos_deliver_confirmed_aggregated_sale_packing_list</string> </value>
</item> </item>
<item> <item>
<key> <string>periodicity_day_frequency</string> </key> <key> <string>periodicity_day_frequency</string> </key>
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Deliver confirmed aggregated deliveries</string> </value> <value> <string>Deliver confirmed aggregated Sale Packing List</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
<?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_stopConfirmedAggregatedSaleInvoiceTransaction</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>slapos_stop_confirmed_aggregated_sale_invoice_transaction</string> </value>
</item>
<item>
<key> <string>periodicity_day_frequency</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>periodicity_hour</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_minute</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_minute_frequency</string> </key>
<value> <int>1</int> </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>3660.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>Stop confirmed aggregated Sale Invoice Transaction</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -55,11 +55,11 @@ from Products.ERP5Type.DateUtils import getClosestDate\n ...@@ -55,11 +55,11 @@ from Products.ERP5Type.DateUtils import getClosestDate\n
\n \n
portal = context.getPortalObject()\n portal = context.getPortalObject()\n
portal.portal_catalog.searchAndActivate(\n portal.portal_catalog.searchAndActivate(\n
portal_type=[\'Sale Invoice Transaction\', \'Sale Packing List\'],\n portal_type=\'Sale Packing List\',\n
simulation_state=\'confirmed\',\n simulation_state=\'confirmed\',\n
causality_state=\'solved\',\n causality_state=\'solved\',\n
specialise_uid=portal.restrictedTraverse(portal.portal_preferences.getPreferredAggregatedSaleTradeCondition()).getUid(),\n specialise_uid=portal.restrictedTraverse(portal.portal_preferences.getPreferredAggregatedSaleTradeCondition()).getUid(),\n
method_id=\'Delivery_deliverConfirmedAggregatedDelivery\',\n method_id=\'Delivery_deliverConfirmedAggregatedSalePackingList\',\n
activate_kw={\'tag\': tag}\n activate_kw={\'tag\': tag}\n
)\n )\n
context.activate(after_tag=tag).getId()\n context.activate(after_tag=tag).getId()\n
...@@ -71,7 +71,7 @@ context.activate(after_tag=tag).getId()\n ...@@ -71,7 +71,7 @@ context.activate(after_tag=tag).getId()\n
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Alarm_deliverConfirmedAggregatedDelivery</string> </value> <value> <string>Alarm_deliverConfirmedAggregatedSalePackingList</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
<?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>from DateTime import DateTime\n
from Products.ERP5Type.DateUtils import getClosestDate\n
\n
portal = context.getPortalObject()\n
portal.portal_catalog.searchAndActivate(\n
portal_type=\'Sale Invoice Transaction\',\n
simulation_state=\'confirmed\',\n
causality_state=\'solved\',\n
specialise_uid=portal.restrictedTraverse(portal.portal_preferences.getPreferredAggregatedSaleTradeCondition()).getUid(),\n
method_id=\'Delivery_stopConfirmedAggregatedSaleInvoiceTransaction\',\n
activate_kw={\'tag\': tag}\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_stopConfirmedAggregatedSaleInvoiceTransaction</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>portal = context.getPortalObject()\n <value> <string>portal = context.getPortalObject()\n
if context.getPortalType() not in (\'Sale Packing List\', \'Sale Invoice Transaction\') \\\n if context.getPortalType() != \'Sale Packing List\' \\\n
and context.getSpecialise() != portal.portal_preferences.getPreferredAggregatedSaleTradeCondition():\n and context.getSpecialise() != portal.portal_preferences.getPreferredAggregatedSaleTradeCondition():\n
raise TypeError(\'Incorrect delivery.\')\n raise TypeError(\'Incorrect delivery.\')\n
isTransitionPossible = portal.portal_workflow.isTransitionPossible\n isTransitionPossible = portal.portal_workflow.isTransitionPossible\n
...@@ -71,7 +71,7 @@ if context.getSimulationState() == \'confirmed\' and len(context.checkConsistenc ...@@ -71,7 +71,7 @@ if context.getSimulationState() == \'confirmed\' and len(context.checkConsistenc
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Delivery_deliverConfirmedAggregatedDelivery</string> </value> <value> <string>Delivery_deliverConfirmedAggregatedSalePackingList</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
<?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
if context.getPortalType() != \'Sale Invoice Transaction\' \\\n
and context.getSpecialise() != portal.portal_preferences.getPreferredAggregatedSaleTradeCondition():\n
raise TypeError(\'Incorrect delivery.\')\n
isTransitionPossible = portal.portal_workflow.isTransitionPossible\n
if context.getSimulationState() == \'confirmed\' and len(context.checkConsistency()) == 0 and context.getCausalityState() == \'solved\':\n
comment = \'Delivered by alarm as all actions in confirmed state are ready.\'\n
if isTransitionPossible(context, \'start\'):\n
context.start(comment=comment)\n
if isTransitionPossible(context, \'stop\'):\n
context.stop(comment=comment)\n
</string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Delivery_stopConfirmedAggregatedSaleInvoiceTransaction</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -1425,3 +1425,11 @@ class TestSlapOSManageBuildingCalculatingDeliveryAlarm(testSlapOSMixin): ...@@ -1425,3 +1425,11 @@ class TestSlapOSManageBuildingCalculatingDeliveryAlarm(testSlapOSMixin):
def test_Delivery_manageBuildingCalculatingDelivery_diverged(self): def test_Delivery_manageBuildingCalculatingDelivery_diverged(self):
self._test_Delivery_manageBuildingCalculatingDelivery('diverged', True) self._test_Delivery_manageBuildingCalculatingDelivery('diverged', True)
class TestSlapOSDeliverConfirmedAggregatedSalePackingListAlarm(testSlapOSMixin):
def test(self):
raise NotImplementedError
class TestSlapOSStopConfirmedAggregatedSaleInvoiceTransactionAlarm(testSlapOSMixin):
def test(self):
raise NotImplementedError
169 170
\ No newline at end of file \ No newline at end of file
...@@ -24,11 +24,12 @@ open_sale_order_module/slapos_accounting_open_sale_order_template ...@@ -24,11 +24,12 @@ open_sale_order_module/slapos_accounting_open_sale_order_template
open_sale_order_module/template_open_sale_order open_sale_order_module/template_open_sale_order
organisation_module/slapos organisation_module/slapos
organisation_module/slapos/bank_account organisation_module/slapos/bank_account
portal_alarms/slapos_deliver_confirmed_aggregated_delivery portal_alarms/slapos_deliver_confirmed_aggregated_sale_packing_list
portal_alarms/slapos_instance_invoicing portal_alarms/slapos_instance_invoicing
portal_alarms/slapos_manage_building_calculating_delivery portal_alarms/slapos_manage_building_calculating_delivery
portal_alarms/slapos_remove_bogus_delivery_link portal_alarms/slapos_remove_bogus_delivery_link
portal_alarms/slapos_request_update_hosting_subscription_open_sale_order portal_alarms/slapos_request_update_hosting_subscription_open_sale_order
portal_alarms/slapos_stop_confirmed_aggregated_sale_invoice_transaction
portal_alarms/slapos_trigger_aggregated_delivery_order_builder portal_alarms/slapos_trigger_aggregated_delivery_order_builder
portal_alarms/slapos_trigger_build portal_alarms/slapos_trigger_build
portal_alarms/slapos_trigger_payment_transaction_order_builder portal_alarms/slapos_trigger_payment_transaction_order_builder
......
...@@ -609,7 +609,7 @@ class TestSlapOSDefaultScenario(TestSlapOSSecurityMixin): ...@@ -609,7 +609,7 @@ class TestSlapOSDefaultScenario(TestSlapOSSecurityMixin):
self.tic() self.tic()
# deliver aggregated deliveries # deliver aggregated deliveries
self.stepCallSlaposDeliverConfirmedAggregatedDeliveryAlarm() self.stepCallSlaposDeliverConfirmedAggregatedSalePackingListAlarm()
self.tic() self.tic()
# stabilise aggregated deliveries and expand them # stabilise aggregated deliveries and expand them
...@@ -636,8 +636,8 @@ class TestSlapOSDefaultScenario(TestSlapOSSecurityMixin): ...@@ -636,8 +636,8 @@ class TestSlapOSDefaultScenario(TestSlapOSSecurityMixin):
self.stepCallSlaposManageBuildingCalculatingDeliveryAlarm() self.stepCallSlaposManageBuildingCalculatingDeliveryAlarm()
self.tic() self.tic()
# deliver the invoices and solve them again # stop the invoices and solve them again
self.stepCallSlaposDeliverConfirmedAggregatedDeliveryAlarm() self.stepCallSlaposStopConfirmedAggregatedSaleInvoiceTransactionAlarm()
self.tic() self.tic()
self.stepCallSlaposManageBuildingCalculatingDeliveryAlarm() self.stepCallSlaposManageBuildingCalculatingDeliveryAlarm()
self.tic() self.tic()
......
109 110
\ 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