Commit e3e391e2 authored by Romain Courteaud's avatar Romain Courteaud

slapos_subscription_request:

* Subscription Request is a ticket like Credential Request
* restore subscription_request_workflow as ticket_workflow
* Subscription Request is not linked to a project
* add Subscription Request Constraint
* new constraint on Subscription Request
* add testSlapOSERP5VirtualMasterSubscriptionRequestScenario
* drop outdated subscription scenarios
* WIP selling project subscription
* forbid Subscription Request which could generate Invoice with a 0 price
* do not allow empty quantity on Subscription Request
* WIP selling virtual master to customer
* improve test Trade Condition
* disable existing Subscription Request alarm
* create Subscription Request from orphaned Instance Tree
* create Open Sale Order from Subscription Request
* drop slapos_subscription_request_process_planned
* drop slapos_subscription_request_process_draft
* drop slapos_subscription_request_process_ordered
* drop slapos_subscription_request_process_confirmed
* drop slapos_subscription_request_process_started
* drop slapos_subscription_request_process_stopped
* drop Alarm_processStoppedSubscriptionRequest
* test slapos_subscription_request_create_from_orphaned_item
* add assert when creating Open Order
* alarm to validate submitted Subscription Request
* create Subscription Requuest manually from a resource
* create Subscription Request for Compute Node
* trigger validation as soon as a Subscription Request is submitted
* decrease slapos_subscription_request_validate_submitted alarm periodicity
* create Subscription Request as soon as a Compute Node is validated
* create Subscription Request as soon as Instance Tree is validated
* use different trade condition for instance and node
* do not generate Subscription for Organisation
  This work must be done later
* constraint: no Organisation as source_section
* constraint: fixup empty price check
* constraint: destination_section is not required
  for accounting less subscription
* stop creating project from subscription request
  It is too complex (as it requires to create Trade Condition, Assignment, Project, etc...), and I don't know for now how to make something generic from it.
  Use a custom action for now.
parent 352b6117
...@@ -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_processConfirmedSubscriptionRequest</string> </value> <value> <string>Alarm_createSubscriptionRequestFromOrphanedItem</string> </value>
</item> </item>
<item> <item>
<key> <string>automatic_solve</string> </key> <key> <string>automatic_solve</string> </key>
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>slapos_subscription_request_process_confirmed</string> </value> <value> <string>slapos_subscription_request_create_from_orphaned_item</string> </value>
</item> </item>
<item> <item>
<key> <string>periodicity_hour</string> </key> <key> <string>periodicity_hour</string> </key>
...@@ -70,7 +70,7 @@ ...@@ -70,7 +70,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1357002060.0</float> <float>1677632460.0</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Process Confirmed Subscription Requests</string> </value> <value> <string>Create Subscription Request from orphaned item</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_processDraftSubscriptionRequest</string> </value>
</item>
<item>
<key> <string>automatic_solve</string> </key>
<value> <int>0</int> </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_subscription_request_process_draft</string> </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="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="DateTime" module="DateTime.DateTime"/>
<global name="object" module="__builtin__"/>
<none/>
</tuple>
<state>
<tuple>
<float>1357002060.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>Process Draft Subscription Requests</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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_processOrderedSubscriptionRequest</string> </value>
</item>
<item>
<key> <string>automatic_solve</string> </key>
<value> <int>0</int> </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_subscription_request_process_ordered</string> </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>2</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="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="DateTime" module="DateTime.DateTime"/>
<global name="object" module="__builtin__"/>
<none/>
</tuple>
<state>
<tuple>
<float>1357002060.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>Process Ordered Subscription Requests</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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_processStartedSubscriptionRequest</string> </value>
</item>
<item>
<key> <string>automatic_solve</string> </key>
<value> <int>0</int> </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_subscription_request_process_started</string> </value>
</item>
<item>
<key> <string>periodicity_hour</string> </key>
<value>
<tuple>
<int>3</int>
</tuple>
</value>
</item>
<item>
<key> <string>periodicity_hour_frequency</string> </key>
<value>
<none/>
</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="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="DateTime" module="DateTime.DateTime"/>
<global name="object" module="__builtin__"/>
<none/>
</tuple>
<state>
<tuple>
<float>1357002060.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>Process Started Subscription Requests</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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_processStoppedSubscriptionRequest</string> </value>
</item>
<item>
<key> <string>automatic_solve</string> </key>
<value> <int>0</int> </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_subscription_request_process_stopped</string> </value>
</item>
<item>
<key> <string>periodicity_hour</string> </key>
<value>
<tuple>
<int>3</int>
</tuple>
</value>
</item>
<item>
<key> <string>periodicity_hour_frequency</string> </key>
<value>
<none/>
</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="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="DateTime" module="DateTime.DateTime"/>
<global name="object" module="__builtin__"/>
<none/>
</tuple>
<state>
<tuple>
<float>1357002060.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>Process Stopped Subscription Requests</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -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_processPlannedSubscriptionRequest</string> </value> <value> <string>Alarm_validateSubmittedSubscriptionRequest</string> </value>
</item> </item>
<item> <item>
<key> <string>automatic_solve</string> </key> <key> <string>automatic_solve</string> </key>
...@@ -26,7 +26,11 @@ ...@@ -26,7 +26,11 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>slapos_subscription_request_process_planned</string> </value> <value> <string>slapos_subscription_request_validate_submitted</string> </value>
</item>
<item>
<key> <string>periodicity_day_frequency</string> </key>
<value> <int>1</int> </value>
</item> </item>
<item> <item>
<key> <string>periodicity_hour</string> </key> <key> <string>periodicity_hour</string> </key>
...@@ -42,7 +46,9 @@ ...@@ -42,7 +46,9 @@
</item> </item>
<item> <item>
<key> <string>periodicity_minute_frequency</string> </key> <key> <string>periodicity_minute_frequency</string> </key>
<value> <int>1</int> </value> <value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>periodicity_month</string> </key> <key> <string>periodicity_month</string> </key>
...@@ -70,7 +76,7 @@ ...@@ -70,7 +76,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1357002060.0</float> <float>1677632460.0</float>
<string>GMT</string> <string>GMT</string>
</tuple> </tuple>
</state> </state>
...@@ -89,7 +95,7 @@ ...@@ -89,7 +95,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Process Planned Subscription Requests</string> </value> <value> <string>Validate submitted Subscription Request</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<item>Person</item> <item>Person</item>
<item>Price</item> <item>Price</item>
<item>Reference</item> <item>Reference</item>
<item>SlapOSVirtualMasterSourceProjectConstraint</item> <item>SlapOSSubscriptionRequestConstraint</item>
<item>Task</item> <item>Task</item>
<item>Url</item> <item>Url</item>
<item>VariationRange</item> <item>VariationRange</item>
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<key> <string>group_list</string> </key> <key> <string>group_list</string> </key>
<value> <value>
<tuple> <tuple>
<string>item</string> <string>ticket</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>type_class</string> </key> <key> <string>type_class</string> </key>
<value> <string>XMLObject</string> </value> <value> <string>CredentialRequest</string> </value>
</item> </item>
<item> <item>
<key> <string>type_interface</string> </key> <key> <string>type_interface</string> </key>
......
<workflow_chain> <workflow_chain>
<chain>
<type>Compute Node</type>
<workflow>slapos_subscription_request_interaction_workflow</workflow>
</chain>
<chain> <chain>
<type>Email</type> <type>Email</type>
<workflow>-coordinate_interaction_workflow</workflow> <workflow>-coordinate_interaction_workflow</workflow>
</chain> </chain>
<chain>
<type>Instance Tree</type>
<workflow>slapos_subscription_request_interaction_workflow</workflow>
</chain>
<chain> <chain>
<type>Subscription Condition</type> <type>Subscription Condition</type>
<workflow>commerce_validation_workflow, edit_workflow</workflow> <workflow>commerce_validation_workflow, edit_workflow</workflow>
</chain> </chain>
<chain> <chain>
<type>Subscription Request</type> <type>Subscription Request</type>
<workflow>edit_workflow, subscription_request_workflow</workflow> <workflow>edit_workflow, slapos_subscription_request_interaction_workflow, subscription_request_workflow</workflow>
</chain> </chain>
</workflow_chain> </workflow_chain>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Property Sheet" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SlapOSSubscriptionRequestConstraint</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Property Sheet</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category Membership Arity Constraint" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>constraint_base_category</string> </key>
<value>
<tuple>
<string>destination</string>
</tuple>
</value>
</item>
<item>
<key> <string>constraint_portal_type</string> </key>
<value> <string>python: (\'Organisation\', )</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>destination_constraint</string> </value>
</item>
<item>
<key> <string>max_arity</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>min_arity</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category Membership Arity Constraint</string> </value>
</item>
<item>
<key> <string>use_acquisition</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category Membership Arity Constraint" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>constraint_base_category</string> </key>
<value>
<tuple>
<string>destination_section</string>
</tuple>
</value>
</item>
<item>
<key> <string>constraint_portal_type</string> </key>
<value> <string>python: (\'Organisation\',)</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>destination_section_constraint</string> </value>
</item>
<item>
<key> <string>max_arity</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>min_arity</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category Membership Arity Constraint</string> </value>
</item>
<item>
<key> <string>use_acquisition</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -2,59 +2,57 @@ ...@@ -2,59 +2,57 @@
<ZopeData> <ZopeData>
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<global name="Workflow State" module="erp5.portal_type"/> <global name="TALES Constraint" module="erp5.portal_type"/>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>acquire_permission</string> </key> <key> <string>_identity_criterion</string> </key>
<value> <value>
<tuple/> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
</item> </item>
<item> <item>
<key> <string>categories</string> </key> <key> <string>_range_criterion</string> </key>
<value> <value>
<tuple> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<string>destination/portal_workflow/subscription_request_workflow/transition_start</string>
<string>destination/portal_workflow/subscription_request_workflow/transition_start_action</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <value> <string>No invoice with price equals 0 must be generated</string> </value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>expression</string> </key>
<value> <string>state_confirmed</string> </value> <value> <string>python: context.getPrice() or (context.getDestinationSection(\'\') in (context.getSourceSection(\'\'), \'\'))</string> </value>
</item> </item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>id</string> </key>
<value> <string>Workflow State</string> </value> <value> <string>empty_price_constraint</string> </value>
</item> </item>
<item> <item>
<key> <string>state_permission_role_list_dict</string> </key> <key> <string>message_expression_false</string> </key>
<value> <value> <string>Price must not be 0</string> </value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item> </item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item> <item>
<key> <string>state_type</string> </key> <key> <string>data</string> </key>
<value> <value>
<tuple/> <dictionary/>
</value> </value>
</item> </item>
<item>
<key> <string>title</string> </key>
<value> <string>Confirmed</string> </value>
</item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
......
...@@ -2,14 +2,20 @@ ...@@ -2,14 +2,20 @@
<ZopeData> <ZopeData>
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<global name="Workflow State" module="erp5.portal_type"/> <global name="TALES Constraint" module="erp5.portal_type"/>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>acquire_permission</string> </key> <key> <string>_identity_criterion</string> </key>
<value> <value>
<tuple/> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
<item> <item>
...@@ -19,33 +25,36 @@ ...@@ -19,33 +25,36 @@
</value> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>expression</string> </key>
<value> <string>state_delivered</string> </value> <value> <string>python: context.getQuantity(0) == 1</string> </value>
</item> </item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>id</string> </key>
<value> <string>Workflow State</string> </value> <value> <string>empty_quantity_constraint</string> </value>
</item> </item>
<item> <item>
<key> <string>state_permission_role_list_dict</string> </key> <key> <string>message_expression_false</string> </key>
<value> <value> <string>Quantity must not be empty</string> </value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item> </item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item> <item>
<key> <string>state_type</string> </key> <key> <string>data</string> </key>
<value> <value>
<tuple/> <dictionary/>
</value> </value>
</item> </item>
<item>
<key> <string>title</string> </key>
<value> <string>Delivered</string> </value>
</item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
......
...@@ -2,19 +2,33 @@ ...@@ -2,19 +2,33 @@
<ZopeData> <ZopeData>
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<global name="Test Component" module="erp5.portal_type"/> <global name="Category Membership Arity Constraint" module="erp5.portal_type"/>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>_recorded_property_dict</string> </key> <key> <string>_identity_criterion</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
</item> </item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>_range_criterion</string> </key>
<value> <string>testSlapOSSubscriptionChineseScenario</string> </value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>constraint_base_category</string> </key>
<value>
<tuple>
<string>price_currency</string>
</tuple>
</value>
</item>
<item>
<key> <string>constraint_portal_type</string> </key>
<value> <string>python: (\'Currency\',)</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
...@@ -24,39 +38,39 @@ ...@@ -24,39 +38,39 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>test.erp5.testSlapOSSubscriptionChineseScenario</string> </value> <value> <string>price_currency_constraint</string> </value>
</item> </item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>max_arity</string> </key>
<value> <string>Test Component</string> </value> <value> <int>1</int> </value>
</item> </item>
<item> <item>
<key> <string>sid</string> </key> <key> <string>message_arity_not_in_range</string> </key>
<value> <value> <string>Exactly one Currency shall be selected</string> </value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>text_content_error_message</string> </key> <key> <string>message_arity_too_small</string> </key>
<value> <value> <string>Exactly one Currency shall be selected</string> </value>
<tuple/>
</value>
</item> </item>
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>message_arity_with_portal_type_not_in_range</string> </key>
<value> <value> <string>Exactly one Currency shall be selected</string> </value>
<tuple/>
</value>
</item> </item>
<item> <item>
<key> <string>version</string> </key> <key> <string>message_arity_with_portal_type_too_small</string> </key>
<value> <string>erp5</string> </value> <value> <string>Exactly one Currency shall be selected</string> </value>
</item> </item>
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>min_arity</string> </key>
<value> <value> <int>1</int> </value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> </item>
</value> <item>
<key> <string>portal_type</string> </key>
<value> <string>Category Membership Arity Constraint</string> </value>
</item>
<item>
<key> <string>use_acquisition</string> </key>
<value> <int>0</int> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
...@@ -85,40 +99,7 @@ ...@@ -85,40 +99,7 @@
<item> <item>
<key> <string>data</string> </key> <key> <string>data</string> </key>
<value> <value>
<dictionary> <dictionary/>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value> </value>
</item> </item>
</dictionary> </dictionary>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category Membership Arity Constraint" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>constraint_base_category</string> </key>
<value>
<tuple>
<string>quantity_unit</string>
</tuple>
</value>
</item>
<item>
<key> <string>constraint_portal_type</string> </key>
<value> <string>python: (\'Category\', )</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>quantity_unit_constraint</string> </value>
</item>
<item>
<key> <string>max_arity</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>min_arity</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category Membership Arity Constraint</string> </value>
</item>
<item>
<key> <string>use_acquisition</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -2,61 +2,72 @@ ...@@ -2,61 +2,72 @@
<ZopeData> <ZopeData>
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<global name="Test Component" module="erp5.portal_type"/> <global name="String Attribute Match Constraint" module="erp5.portal_type"/>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>_identity_criterion</string> </key>
<value> <string>testSlapOSSubscriptionCDNScenario</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <value>
<none/> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>_local_properties</string> </key>
<value> <value>
<none/> <tuple>
</value> <dictionary>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>test.erp5.testSlapOSSubscriptionCDNScenario</string> </value> <value> <string>message_property_not_set</string> </value>
</item> </item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>type</string> </key>
<value> <string>Test Component</string> </value> <value> <string>string</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item> </item>
<item> <item>
<key> <string>sid</string> </key> <key> <string>_range_criterion</string> </key>
<value> <value>
<none/> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
<item> <item>
<key> <string>text_content_error_message</string> </key> <key> <string>constraint_property</string> </key>
<value> <value>
<tuple/> <tuple>
<string>reference</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>description</string> </key>
<value> <value>
<tuple/> <none/>
</value> </value>
</item> </item>
<item> <item>
<key> <string>version</string> </key> <key> <string>id</string> </key>
<value> <string>erp5</string> </value> <value> <string>reference_not_empty_constraint</string> </value>
</item> </item>
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>message_attribute_match</string> </key>
<value> <value> <string>Reference must be defined</string> </value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> </item>
</value> <item>
<key> <string>message_no_such_property</string> </key>
<value> <string>Reference must be defined</string> </value>
</item>
<item>
<key> <string>message_property_not_set</string> </key>
<value> <string>Reference must be defined</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>String Attribute Match Constraint</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
...@@ -70,14 +81,7 @@ ...@@ -70,14 +81,7 @@
<item> <item>
<key> <string>data</string> </key> <key> <string>data</string> </key>
<value> <value>
<dictionary> <dictionary/>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -85,25 +89,14 @@ ...@@ -85,25 +89,14 @@
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>_log</string> </key> <key> <string>data</string> </key>
<value> <value>
<list> <dictionary/>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value> </value>
</item> </item>
</dictionary> </dictionary>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category Membership Arity Constraint" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>constraint_base_category</string> </key>
<value>
<tuple>
<string>resource</string>
</tuple>
</value>
</item>
<item>
<key> <string>constraint_portal_type</string> </key>
<value> <string>python: (\'Service\', \'Software Product\')</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>resource_constraint</string> </value>
</item>
<item>
<key> <string>max_arity</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>min_arity</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category Membership Arity Constraint</string> </value>
</item>
<item>
<key> <string>use_acquisition</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -2,25 +2,34 @@ ...@@ -2,25 +2,34 @@
<ZopeData> <ZopeData>
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<global name="Workflow State" module="erp5.portal_type"/> <global name="Category Membership Arity Constraint" module="erp5.portal_type"/>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>acquire_permission</string> </key> <key> <string>_identity_criterion</string> </key>
<value> <value>
<tuple/> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
</item> </item>
<item> <item>
<key> <string>categories</string> </key> <key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>constraint_base_category</string> </key>
<value> <value>
<tuple> <tuple>
<string>destination/portal_workflow/subscription_request_workflow/transition_confirm</string> <string>source</string>
<string>destination/portal_workflow/subscription_request_workflow/transition_confirm_action</string>
</tuple> </tuple>
</value> </value>
</item> </item>
<item>
<key> <string>constraint_portal_type</string> </key>
<value> <string>python: (\'Person\',)</string> </value>
</item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <value>
...@@ -29,27 +38,23 @@ ...@@ -29,27 +38,23 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>state_ordered</string> </value> <value> <string>source_constraint</string> </value>
</item> </item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>max_arity</string> </key>
<value> <string>Workflow State</string> </value> <value> <int>1</int> </value>
</item> </item>
<item> <item>
<key> <string>state_permission_role_list_dict</string> </key> <key> <string>min_arity</string> </key>
<value> <value> <int>1</int> </value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item> </item>
<item> <item>
<key> <string>state_type</string> </key> <key> <string>portal_type</string> </key>
<value> <value> <string>Category Membership Arity Constraint</string> </value>
<tuple/>
</value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>use_acquisition</string> </key>
<value> <string>Ordered</string> </value> <value> <int>0</int> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
...@@ -69,4 +74,19 @@ ...@@ -69,4 +74,19 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category Membership Arity Constraint" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>constraint_base_category</string> </key>
<value>
<tuple>
<string>source_decision</string>
</tuple>
</value>
</item>
<item>
<key> <string>constraint_portal_type</string> </key>
<value> <string>python: (\'Person\',)</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>source_decision_constraint</string> </value>
</item>
<item>
<key> <string>max_arity</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>min_arity</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category Membership Arity Constraint</string> </value>
</item>
<item>
<key> <string>use_acquisition</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -2,25 +2,34 @@ ...@@ -2,25 +2,34 @@
<ZopeData> <ZopeData>
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<global name="Workflow State" module="erp5.portal_type"/> <global name="Category Membership Arity Constraint" module="erp5.portal_type"/>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>acquire_permission</string> </key> <key> <string>_identity_criterion</string> </key>
<value> <value>
<tuple/> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
</item> </item>
<item> <item>
<key> <string>categories</string> </key> <key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>constraint_base_category</string> </key>
<value> <value>
<tuple> <tuple>
<string>destination/portal_workflow/subscription_request_workflow/transition_order</string> <string>source_section</string>
<string>destination/portal_workflow/subscription_request_workflow/transition_order_action</string>
</tuple> </tuple>
</value> </value>
</item> </item>
<item>
<key> <string>constraint_portal_type</string> </key>
<value> <string>python: (\'Person\',)</string> </value>
</item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
<value> <value>
...@@ -29,27 +38,23 @@ ...@@ -29,27 +38,23 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>state_planned</string> </value> <value> <string>source_section_constraint</string> </value>
</item> </item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>max_arity</string> </key>
<value> <string>Workflow State</string> </value> <value> <int>1</int> </value>
</item> </item>
<item> <item>
<key> <string>state_permission_role_list_dict</string> </key> <key> <string>min_arity</string> </key>
<value> <value> <int>1</int> </value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item> </item>
<item> <item>
<key> <string>state_type</string> </key> <key> <string>portal_type</string> </key>
<value> <value> <string>Category Membership Arity Constraint</string> </value>
<tuple/>
</value>
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>use_acquisition</string> </key>
<value> <string>Planned</string> </value> <value> <int>0</int> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
...@@ -69,4 +74,19 @@ ...@@ -69,4 +74,19 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Category Membership Arity Constraint" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>constraint_base_category</string> </key>
<value>
<tuple>
<string>specialise</string>
</tuple>
</value>
</item>
<item>
<key> <string>constraint_portal_type</string> </key>
<value> <string>python: (\'Sale Trade Condition\',)</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>specialise_constraint</string> </value>
</item>
<item>
<key> <string>max_arity</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>min_arity</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Category Membership Arity Constraint</string> </value>
</item>
<item>
<key> <string>use_acquisition</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -2,55 +2,68 @@ ...@@ -2,55 +2,68 @@
<ZopeData> <ZopeData>
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<global name="Test Component" module="erp5.portal_type"/> <global name="Property Existence Constraint" module="erp5.portal_type"/>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>_identity_criterion</string> </key>
<value> <string>testSlapOSSubscriptionScenario</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <value>
<none/> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
</item> </item>
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>test.erp5.testSlapOSSubscriptionScenario</string> </value> <value> <string>message_property_not_set</string> </value>
</item> </item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>type</string> </key>
<value> <string>Test Component</string> </value> <value> <string>string</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item> </item>
<item> <item>
<key> <string>sid</string> </key> <key> <string>_range_criterion</string> </key>
<value> <value>
<none/> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
<item> <item>
<key> <string>text_content_error_message</string> </key> <key> <string>constraint_property</string> </key>
<value> <value>
<tuple/> <tuple>
<string>start_date</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>description</string> </key>
<value> <value>
<tuple/> <none/>
</value> </value>
</item> </item>
<item> <item>
<key> <string>version</string> </key> <key> <string>id</string> </key>
<value> <string>erp5</string> </value> <value> <string>start_date_existence_constraint</string> </value>
</item> </item>
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>message_no_such_property</string> </key>
<value> <value> <string>Property start_date must be defined</string> </value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> </item>
</value> <item>
<key> <string>message_property_not_set</string> </key>
<value> <string>Property start_date must be defined</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Property Existence Constraint</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
...@@ -64,14 +77,7 @@ ...@@ -64,14 +77,7 @@
<item> <item>
<key> <string>data</string> </key> <key> <string>data</string> </key>
<value> <value>
<dictionary> <dictionary/>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -79,25 +85,14 @@ ...@@ -79,25 +85,14 @@
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>_log</string> </key> <key> <string>data</string> </key>
<value> <value>
<list> <dictionary/>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value> </value>
</item> </item>
</dictionary> </dictionary>
......
...@@ -2,23 +2,20 @@ ...@@ -2,23 +2,20 @@
<ZopeData> <ZopeData>
<record id="1" aka="AAAAAAAAAAE="> <record id="1" aka="AAAAAAAAAAE=">
<pickle> <pickle>
<global name="Workflow State" module="erp5.portal_type"/> <global name="TALES Constraint" module="erp5.portal_type"/>
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>acquire_permission</string> </key> <key> <string>_identity_criterion</string> </key>
<value> <value>
<tuple/> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
</item> </item>
<item> <item>
<key> <string>categories</string> </key> <key> <string>_range_criterion</string> </key>
<value> <value>
<tuple> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<string>destination/portal_workflow/subscription_request_workflow/transition_stop</string>
<string>destination/portal_workflow/subscription_request_workflow/transition_stop_action</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -28,33 +25,36 @@ ...@@ -28,33 +25,36 @@
</value> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>expression</string> </key>
<value> <string>state_started</string> </value> <value> <string>python: context.getQuantityUnit(\'\').startswith(\'time/month\')</string> </value>
</item> </item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>id</string> </key>
<value> <string>Workflow State</string> </value> <value> <string>time_quantity_unit_constraint</string> </value>
</item> </item>
<item> <item>
<key> <string>state_permission_role_list_dict</string> </key> <key> <string>message_expression_false</string> </key>
<value> <value> <string>A "time" quantity unit is required</string> </value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item> </item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item> <item>
<key> <string>state_type</string> </key> <key> <string>data</string> </key>
<value> <value>
<tuple/> <dictionary/>
</value> </value>
</item> </item>
<item>
<key> <string>title</string> </key>
<value> <string>Started</string> </value>
</item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
......
portal = context.getPortalObject()
from Products.ZSQLCatalog.SQLCatalog import SimpleQuery, NegatedQuery
# XXX TODO this is really not efficient
# this does not scale with millions of uid
# how to use a left join instead? or a single query with the embedded subquery?
subscribed_uid_list = [x.uid for x in portal.portal_catalog(
portal_type=["Compute Node", "Instance Tree"],
aggregate__related__portal_type="Subscription Request"
)]
sql_kw = {}
if subscribed_uid_list:
sql_kw['subscribed_uid_list'] = NegatedQuery(SimpleQuery(uid=subscribed_uid_list))
return portal.portal_catalog.searchAndActivate(
method_id='Item_createSubscriptionRequest',
portal_type=["Compute Node", "Instance Tree"],
activate_kw={'tag': tag},
**sql_kw
)
"""
# XXX if there is a non Subscription Request with such aggregate link
# it will lead to not creating the Subscription Request
# TODO find a way to check the portal type
select_dict= {'aggregate__related__uid': None}
kw = {}
kw['select_dict'] = select_dict
kw['left_join_list'] = select_dict.keys()
kw.update(select_dict)
portal.portal_catalog.searchAndActivate(
method_id='Item_createSubscriptionRequest',
# Project are created only from UI for now
portal_type=["Instance Tree", "Compute Node"],
activate_kw={'tag': tag},
**kw
)
"""
context.activate(after_tag=tag).getId()
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Alarm_processPlannedSubscriptionRequest</string> </value> <value> <string>Alarm_createSubscriptionRequestFromOrphanedItem</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
from DateTime import DateTime
portal = context.getPortalObject()
portal.portal_catalog.searchAndActivate(
portal_type="Subscription Request",
simulation_state="draft",
method_id="SubscriptionRequest_verifyReservationPaymentTransaction",
activate_kw={tag: tag}
)
context.activate(after_tag=tag).getId()
from DateTime import DateTime
portal = context.getPortalObject()
portal.portal_catalog.searchAndActivate(
portal_type="Subscription Request",
simulation_state="ordered",
method_id="SubscriptionRequest_processOrdered",
activate_kw={tag: tag}
)
context.activate(after_tag=tag).getId()
from DateTime import DateTime
portal = context.getPortalObject()
portal.portal_catalog.searchAndActivate(
portal_type="Subscription Request",
simulation_state="planned",
method_id="SubscriptionRequest_boostrapUserAccount",
activate_kw={tag: tag}
)
context.activate(after_tag=tag).getId()
from DateTime import DateTime
portal = context.getPortalObject()
portal.portal_catalog.searchAndActivate(
portal_type="Subscription Request",
simulation_state="started",
method_id="SubscriptionRequest_processStarted",
activate_kw={tag: tag}
)
context.activate(after_tag=tag).getId()
from DateTime import DateTime
portal = context.getPortalObject()
portal.portal_catalog.searchAndActivate(
portal_type="Subscription Request",
simulation_state="stopped",
method_id="SubscriptionRequest_processStopped",
activity_kw={tag: tag}
)
context.activate(after_tag=tag).getId()
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</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>tag, fixit, params</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Alarm_processStoppedSubscriptionRequest</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
from DateTime import DateTime
portal = context.getPortalObject() portal = context.getPortalObject()
portal.portal_catalog.searchAndActivate( portal.portal_catalog.searchAndActivate(
portal_type="Subscription Request", method_id='SubscriptionRequest_validateIfSubmitted',
simulation_state="confirmed", # Project are created only from UI for now
method_id="SubscriptionRequest_processConfirmed", portal_type=["Subscription Request"],
activate_kw={tag: tag} simulation_state='submitted',
activate_kw={'tag': tag}
) )
context.activate(after_tag=tag).getId() context.activate(after_tag=tag).getId()
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Alarm_processConfirmedSubscriptionRequest</string> </value> <value> <string>Alarm_validateSubmittedSubscriptionRequest</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
from zExceptions import Unauthorized
if REQUEST is not None:
raise Unauthorized
item = context
portal = context.getPortalObject()
tag = '%s_%s' % (item.getUid(), script.id)
activate_kw = {'tag': tag}
if 0 < portal.portal_activities.countMessageWithTag(tag):
# nothing to do
return
def storeWorkflowComment(document, comment):
portal_workflow = document.portal_workflow
last_workflow_item = portal_workflow.getInfoFor(ob=document,
name='comment', wf_id='edit_workflow')
if last_workflow_item != comment:
portal_workflow.doActionFor(document, action='edit_action', comment=comment)
# Search an existing related subscription
subscription_request = portal.portal_catalog.getResultValue(
portal_type='Subscription Request',
aggregate__uid=item.getUid()
)
if subscription_request is not None:
return
#################################################################
# Find matching Service
service = None
source_decision_value = None
resource_vcl = []
if item.getPortalType() == 'Instance Tree':
service, software_release, software_type = item.InstanceTree_getSoftwareProduct()
source_decision_value = item.getDestinationSectionValue(portal_type="Person")
if service is not None:
resource_vcl = [
'software_release/%s' % software_release.getRelativeUrl(),
'software_type/%s' % software_type.getRelativeUrl()
]
resource_vcl.sort()
project_value = item.getFollowUpValue(portal_type="Project")
elif item.getPortalType() == 'Compute Node':
service = portal.restrictedTraverse('service_module/slapos_compute_node_subscription')
resource_vcl = None
project_value = item.getFollowUpValue(portal_type="Project")
if project_value is not None:
source_decision_value = project_value.getDestinationValue(portal_type="Person")
else:
raise ValueError('Unsupported portal type: %s (%s)' % (item.getPortalType(), item.getRelativeUrl()))
# service = self.portal.restrictedTraverse('service_module/slapos_virtual_master_subscription')
if service is None:
storeWorkflowComment(item, 'Can not find a matching Service to generate the Subscription Request')
return
if source_decision_value is None:
storeWorkflowComment(item, 'Can not find the person to contact to generate the Subscription Request')
return
try:
subscription_request = service.Resource_createSubscriptionRequest(source_decision_value, resource_vcl, project_value)
except AssertionError, error:
storeWorkflowComment(item, str(error))
return
subscription_request.setAggregateValue(item)
# Prevent concurrent transactions which could create the Subscription Request
item.serialize()
...@@ -50,11 +50,11 @@ ...@@ -50,11 +50,11 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>tag, fixit, params</string> </value> <value> <string>REQUEST=None</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Alarm_processDraftSubscriptionRequest</string> </value> <value> <string>Item_createSubscriptionRequest</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
portal = context.getPortalObject()
resource = context
if subscriber_person_value is None:
raise AssertionError('Can not find a person profile')
source_project_value = None
destination_project_value = None
item = None
if resource.getPortalType() == "Software Product":
source_project_value = project_value
elif resource.getPortalType() == "Service":
if resource.getRelativeUrl() == "service_module/slapos_compute_node_subscription":
if project_value is None:
raise AssertionError('A project is required for %s %s' % (resource.getRelativeUrl(), project_value))
destination_project_value = project_value
elif resource.getRelativeUrl() == "service_module/slapos_virtual_master_subscription":
if project_value is None:
raise AssertionError('Project is required for %s %s' % (resource.getRelativeUrl(), project_value))
item = project_value
else:
raise NotImplementedError('Unsupported resource: %s' % resource.getRelativeUrl())
else:
raise NotImplementedError('Unsupported resource: %s' % resource.getRelativeUrl())
######################################################
# Find Sale Trade Condition and price
# source_section = subscriber_person_value.getCareerSubordination(subscriber_person_value.getRelativeUrl())
source_section = subscriber_person_value.getRelativeUrl()
# Create a temp Sale Order to calculate the real price and find the trade condition
now = DateTime()
module = portal.portal_trash
#aggregate_value_list = []
tmp_sale_order = module.newContent(
portal_type='Sale Order',
temp_object=True,
#effective_date=now+1,
start_date=now,
# Ensure stop date value is higher than start date
# it will be updated by OpenSaleOrder_updatePeriod
# stop_date=now + 2,
destination_value=subscriber_person_value,
destination_section=source_section,
#destination_decision_value=source_decision_value,
destination_project_value=destination_project_value,
source_project_value=source_project_value,
ledger_value=portal.portal_categories.ledger.automated,
# XXX XXX destination_project_value=instance_tree.getFollowUpValue(),
)
tmp_sale_order.SaleOrder_applySaleTradeCondition(batch_mode=1, force=1)
if tmp_sale_order.getSpecialise(None) is None:
raise AssertionError('Can not find a trade condition to generate the Subscription Request')
# If no accounting is needed, no need to check the price
if (tmp_sale_order.getSourceSection(None) == tmp_sale_order.getDestinationSection(None)) or \
(tmp_sale_order.getSourceSection(None) is None):
price = 0
else:
# Add line
tmp_order_line = tmp_sale_order.newContent(
portal_type='Sale Order Line',
temp_object=True,
resource_value=resource,
variation_category_list=variation_category_list,
quantity_unit=resource.getQuantityUnit(),
base_contribution_list=resource.getBaseContributionList(),
use=resource.getUse(),
quantity=1
)
if variation_category_list:
base_id = 'movement'
cell_key = list(tmp_order_line.getCellKeyList(base_id=base_id))[0]
tmp_order_cell = tmp_order_line.newCell(
base_id=base_id,
portal_type='Sale Order Cell',
temp_object=True,
*cell_key
)
tmp_order_cell.edit(
mapped_value_property_list=['price','quantity'],
quantity=1,
predicate_category_list=cell_key,
variation_category_list=cell_key
)
price = tmp_order_cell.getPrice(0)
else:
price = tmp_order_line.getPrice(0)
if not price:
raise AssertionError('Can not find a price to generate the Subscription Request')
subscription_request = portal.subscription_request_module.newContent(
portal_type='Subscription Request',
source_value=subscriber_person_value,
source_section_value=source_section,
source_decision_value=subscriber_person_value,
source_project_value=source_project_value,
start_date=now,
effective_date=now,
resource_value=resource,
variation_category_list=variation_category_list,
aggregate_value=item,
quantity_unit=resource.getQuantityUnit(),
quantity=1,
ledger="automated",
specialise_value=tmp_sale_order.getSpecialiseValue(),
destination=tmp_sale_order.getSource(),
destination_section=tmp_sale_order.getSourceSection(),
destination_project_value=destination_project_value,
price_currency=tmp_sale_order.getPriceCurrency(),
price=price,
# XXX activate_kw=activate_kw
)
"""
if len(subscription_request.checkConsistency()) != 0:
raise NotImplementedError(subscription_request.checkConsistency())
"""
subscription_request.submit()
return subscription_request
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="_reconstructor" module="copy_reg"/>
</klass>
<tuple>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
<global name="object" module="__builtin__"/>
<none/>
</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>subscriber_person_value, variation_category_list, project_value</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Resource_createSubscriptionRequest</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
portal = context.getPortalObject()
subscription_request = context
assert subscription_request.getAggregate('') != ''
activate_kw = None
#######################################################
# Hosting Subscription
hosting_subscription = portal.hosting_subscription_module.newContent(
portal_type="Hosting Subscription",
title="hosting %s" % subscription_request.getTitle(),
#follow_up_value=instance_tree.getFollowUpValue(),
ledger_value=portal.portal_categories.ledger.automated,
)
hosting_subscription.validate()
#######################################################
# Open Sale Order
start_date = hosting_subscription.HostingSubscription_calculateSubscriptionStartDate()
open_sale_order = portal.open_sale_order_module.newContent(
portal_type="Open Sale Order",
start_date=start_date,
# Ensure stop date value is higher than start date
# it will be updated by OpenSaleOrder_updatePeriod
stop_date=start_date + 1,
specialise_value=subscription_request.getSpecialiseValue(),
source_value=subscription_request.getDestinationValue(),
source_section_value=subscription_request.getDestinationSectionValue(),
source_decision_value=subscription_request.getDestinationDecisionValue(),
source_project_value=subscription_request.getDestinationProjectValue(),
destination_value=subscription_request.getSourceValue(),
destination_section_value=subscription_request.getSourceSectionValue(),
destination_decision_value=subscription_request.getSourceDecisionValue(),
destination_project_value=subscription_request.getSourceProjectValue(),
ledger_value=portal.portal_categories.ledger.automated,
causality_value=subscription_request,
price_currency_value=subscription_request.getPriceCurrencyValue(),
activate_kw=activate_kw
)
variation_category_list = subscription_request.getVariationCategoryList()
open_order_line = open_sale_order.newContent(
portal_type="Open Sale Order Line",
resource_value=subscription_request.getResourceValue(),
variation_category_list=variation_category_list,
quantity_unit_value=subscription_request.getQuantityUnitValue(),
base_contribution_list=subscription_request.getBaseContributionList(),
use=subscription_request.getUse(),
activate_kw=activate_kw
)
if variation_category_list:
base_id = 'path'
cell_key = list(open_order_line.getCellKeyList(base_id=base_id))[0]
open_order_cell = open_order_line.newCell(
base_id=base_id,
portal_type="Open Sale Order Cell",
*cell_key
)
open_order_cell.edit(
mapped_value_property_list=['price','quantity'],
predicate_category_list=cell_key,
variation_category_list=cell_key,
activate_kw=activate_kw
)
else:
open_order_cell = open_order_line
open_order_cell.edit(
quantity=subscription_request.getQuantity(),
price=subscription_request.getPrice(),
aggregate_value_list=[
hosting_subscription,
subscription_request.getAggregateValue()
],
activate_kw=activate_kw
)
open_sale_order.OpenSaleOrder_updatePeriod()
open_sale_order.plan()
open_sale_order.validate()
return open_sale_order
...@@ -50,11 +50,11 @@ ...@@ -50,11 +50,11 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>tag, fixit, params</string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Alarm_processStartedSubscriptionRequest</string> </value> <value> <string>SubscriptionRequest_createOpenSaleOrder</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
subscription_request = context
item = subscription_request.getAggregateValue()
if item is None:
resource = subscription_request.getResourceValue()
raise ValueError('Unsupported resource: %s' % resource.getRelativeUrl())
# Use list setter, to ensure it crashes if item is still None
# subscription_request.setAggregateValueList([item])
subscription_request.SubscriptionRequest_createOpenSaleOrder()
subscription_request.validate()
subscription_request.invalidate()
...@@ -50,11 +50,11 @@ ...@@ -50,11 +50,11 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>tag, fixit, params</string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>Alarm_processOrderedSubscriptionRequest</string> </value> <value> <string>SubscriptionRequest_validateIfSubmitted</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>testSlapOSSubscriptionCancellationScenario</string> </value> <value> <string>testSlapOSERP5VirtualMasterSubscriptionRequestScenario</string> </value>
</item> </item>
<item> <item>
<key> <string>default_source_reference</string> </key> <key> <string>default_source_reference</string> </key>
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>test.erp5.testSlapOSSubscriptionCancellationScenario</string> </value> <value> <string>test.erp5.testSlapOSERP5VirtualMasterSubscriptionRequestScenario</string> </value>
</item> </item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
......
...@@ -23,77 +23,42 @@ from erp5.component.test.SlapOSTestCaseMixin import \ ...@@ -23,77 +23,42 @@ from erp5.component.test.SlapOSTestCaseMixin import \
class TestSlapOSSubscriptionRequestProcessAlarm(SlapOSTestCaseMixin): class TestSlapOSSubscriptionRequestProcessAlarm(SlapOSTestCaseMixin):
def test_alarm_slapos_subscription_request_process_draft(self): def test_alarm_slapos_subscription_request_create_from_orphaned_item(self):
script_name = "SubscriptionRequest_verifyReservationPaymentTransaction" script_name = "Item_createSubscriptionRequest"
alarm = self.portal.portal_alarms.slapos_subscription_request_process_draft alarm = self.portal.portal_alarms.slapos_subscription_request_create_from_orphaned_item
subscription_request = self.portal.subscription_request_module.newContent( #####################################################
portal_type='Subscription Request', # Instance Tree without Subscription Request
title="Test Subscription Request %s" % self.new_id, instance_tree = self.portal.instance_tree_module.newContent(
reference="TESTSUBSCRIPTIONREQUEST-%s" % self.new_id portal_type='Instance Tree',
title="Test Instance Tree no subscription %s" % self.new_id
) )
self._test_alarm(alarm, instance_tree, script_name)
self._test_alarm( #####################################################
alarm, subscription_request, script_name) # Instance Tree with Subscription Request
instance_tree = self.portal.instance_tree_module.newContent(
def test_alarm_slapos_subscription_request_process_planned(self): portal_type='Instance Tree',
script_name = "SubscriptionRequest_boostrapUserAccount" title="Test Instance Tree no subscription %s" % self.new_id
alarm = self.portal.portal_alarms.slapos_subscription_request_process_planned
subscription_request = self.portal.subscription_request_module.newContent(
portal_type='Subscription Request',
title="Test Subscription Request %s" % self.new_id,
reference="TESTSUBSCRIPTIONREQUEST-%s" % self.new_id
) )
subscription_request.plan() self.portal.subscription_request_module.newContent(
self._test_alarm(
alarm, subscription_request, script_name)
def test_alarm_slapos_subscription_request_process_ordered(self):
script_name = "SubscriptionRequest_processOrdered"
alarm = self.portal.portal_alarms.slapos_subscription_request_process_ordered
subscription_request = self.portal.subscription_request_module.newContent(
portal_type='Subscription Request', portal_type='Subscription Request',
title="Test Subscription Request %s" % self.new_id, title="Test Subscription Request %s" % self.new_id,
reference="TESTSUBSCRIPTIONREQUEST-%s" % self.new_id aggregate_value=instance_tree
) )
subscription_request.plan() self._test_alarm_not_visited(alarm, instance_tree, script_name)
subscription_request.order()
self._test_alarm( #####################################################
alarm, subscription_request, script_name) # Instance Tree aggregated to another portal type
instance_tree = self.portal.instance_tree_module.newContent(
def test_alarm_slapos_subscription_request_process_confirmed(self): portal_type='Instance Tree',
script_name = "SubscriptionRequest_processConfirmed" title="Test Instance Tree another portal type %s" % self.new_id
alarm = self.portal.portal_alarms.slapos_subscription_request_process_confirmed
subscription_request = self.portal.subscription_request_module.newContent(
portal_type='Subscription Request',
title="Test Subscription Request %s" % self.new_id,
reference="TESTSUBSCRIPTIONREQUEST-%s" % self.new_id
) )
subscription_request.plan() self.portal.sale_packing_list_module.newContent(
subscription_request.order() portal_type='Sale Packing List',
subscription_request.confirm() title="Test Sale Packing List %s" % self.new_id,
).newContent(
self._test_alarm( portal_type="Sale Packing List Line",
alarm, subscription_request, script_name) aggregate_value=instance_tree
def test_alarm_slapos_subscription_request_process_started(self):
script_name = "SubscriptionRequest_processStarted"
alarm = self.portal.portal_alarms.slapos_subscription_request_process_started
subscription_request = self.portal.subscription_request_module.newContent(
portal_type='Subscription Request',
title="Test Subscription Request %s" % self.new_id,
reference="TESTSUBSCRIPTIONREQUEST-%s" % self.new_id
) )
subscription_request.plan() self._test_alarm(alarm, instance_tree, script_name)
subscription_request.order()
subscription_request.confirm()
subscription_request.start()
self._test_alarm(
alarm, subscription_request, script_name)
...@@ -6,12 +6,6 @@ ...@@ -6,12 +6,6 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>testSlapOSSubscriptionAlarm</string> </value> <value> <string>testSlapOSSubscriptionAlarm</string> </value>
...@@ -55,28 +49,13 @@ ...@@ -55,28 +49,13 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -89,7 +68,7 @@ ...@@ -89,7 +68,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -98,7 +77,7 @@ ...@@ -98,7 +77,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="4" aka="AAAAAAAAAAQ="> <record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
# -*- coding:utf-8 -*-
##############################################################################
#
# Copyright (c) 2019 Nexedi SA and Contributors. All Rights Reserved.
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from erp5.component.test.testSlapOSSubscriptionCDNScenario import TestSlapOSSubscriptionCDNScenarioMixin
from erp5.component.test.SlapOSTestCaseMixin import changeSkin
class TestSlapOSSubscriptionChineseCDNScenarioMixin(TestSlapOSSubscriptionCDNScenarioMixin):
def afterSetUp(self):
self.expected_slapos_organisation = self.expected_zh_slapos_organisation
TestSlapOSSubscriptionCDNScenarioMixin.afterSetUp(self)
self.expected_price_currency = "currency_module/CNY"
self.normal_user = None
self.expected_notification_language = "zh"
self.login()
@changeSkin('Hal')
def _requestSubscription(self, **kw):
return self._requestSubscriptionViaChineseWebsite(**kw)
def createSubscriptionCondition(self, slave=False):
self.subscription_condition = self.createChineseSubscriptionCondition(
slave=slave)
class TestSlapOSSubscriptionCDNChineseScenario(TestSlapOSSubscriptionChineseCDNScenarioMixin):
def test_subscription_scenario_with_single_vm(self):
self._test_subscription_scenario(amount=1)
def test_subscription_with_3_vms_scenario(self):
self._test_subscription_scenario(amount=3)
def test_subscription_scenario_with_reversal_transaction(self):
self._test_subscription_scenario_with_reversal_transaction(amount=1)
def test_two_subscription_scenario(self):
self._test_two_subscription_scenario(amount=1)
def test_subscription_scenario_with_existing_user(self):
self._test_subscription_scenario_with_existing_user(amount=1, language="zh")
def test_subscription_scenario_with_existing_user_with_non_subscription_request(self):
self._test_subscription_scenario_with_existing_user_with_non_subscription_request(amount=1, language="en")
def test_subscription_scenario_with_existing_english_user(self):
# Messages are in chinese, when subscribed via chinese website. Even if the english language is
# english
self._test_subscription_scenario_with_existing_user(amount=1, language="en")
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testSlapOSSubscriptionCDNChineseScenario</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testSlapOSSubscriptionCDNChineseScenario</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
# -*- coding:utf-8 -*-
##############################################################################
#
# Copyright (c) 2019 Nexedi SA and Contributors. All Rights Reserved.
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from erp5.component.test.testSlapOSSubscriptionScenario import TestSlapOSSubscriptionScenarioMixin
class TestSlapOSSubscriptionCDNScenarioMixin(TestSlapOSSubscriptionScenarioMixin):
def afterSetUp(self):
TestSlapOSSubscriptionScenarioMixin.afterSetUp(self)
self.expected_individual_price_without_tax = 5
self.expected_individual_price_with_tax = 6.0
self.expected_reservation_fee = 1.2
self.expected_reservation_fee_without_tax = 1
self.expected_reservation_quantity_tax = 1.0
self.expected_reservation_tax = 0.2
self.expected_price_currency = "currency_module/EUR"
self.expected_zh_individual_price_without_tax = 40
self.expected_zh_individual_price_with_tax = 40
self.expected_zh_reservation_fee = 8.0
self.expected_zh_reservation_fee_without_tax = 8.0
self.expected_zh_reservation_quantity_tax = 8.0
self.expected_zh_reservation_tax = 0
self.resource_variation_reference = "CDN"
self.login()
# Overwrite default Subscription Condition.
self.createSubscriptionCondition(slave=True)
# some preparation
self.logout()
def createPublicServerForAdminUser(self):
subscription_server = TestSlapOSSubscriptionScenarioMixin.createPublicServerForAdminUser(self)
self.login()
contract = self.admin_user.Person_generateCloudContract(batch=True)
if contract.getValidationState() in ["draft", "invalidated"]:
contract.validate()
self.tic()
# now instantiate it on compute_node and set some nice connection dict
self.setServerOpenPublic(subscription_server)
self.login(self.admin_user.getUserId())
self.personRequestInstanceNotReady(
software_release=self.subscription_condition.getUrlString(),
software_type=self.subscription_condition.getSourceReference(),
partition_reference="InstanceForSlave%s" % self.new_id,
project_reference=self.subscription_project.getReference()
)
self.stepCallSlaposAllocateInstanceAlarm()
self.tic()
self.personRequestInstance(
software_release=self.subscription_condition.getUrlString(),
software_type=self.subscription_condition.getSourceReference(),
partition_reference="InstanceForSlave%s" % self.new_id,
project_reference=self.subscription_project.getReference()
)
# now instantiate it on compute_node and set some nice connection dict
self.simulateSlapgridCP(subscription_server)
self.tic()
self.login()
#self.setServerOpenSubscription(subscription_server)
self.setAccessToMemcached(subscription_server)
self.tic()
self.simulateSlapgridCP(subscription_server)
self.logout()
return subscription_server
class TestSlapOSSubscriptionCDNScenario(TestSlapOSSubscriptionCDNScenarioMixin):
def test_subscription_scenario_with_single_vm(self):
self._test_subscription_scenario(amount=1)
def test_subscription_with_3_vms_scenario(self):
self._test_subscription_scenario(amount=3)
def test_subscription_scenario_with_reversal_transaction(self):
self._test_subscription_scenario_with_reversal_transaction(amount=1)
def test_two_subscription_scenario(self):
self._test_two_subscription_scenario(amount=1)
def test_subscription_scenario_with_existing_user(self):
self._test_subscription_scenario_with_existing_user(amount=1, language="zh")
def test_subscription_scenario_with_existing_user_with_non_subscription_request(self):
self._test_subscription_scenario_with_existing_user_with_non_subscription_request(amount=1, language="en")
def test_subscription_scenario_with_existing_chinese_user(self):
# Messages are in chinese, when subscribed via chinese website. Even if the english language is
# english
self._test_subscription_scenario_with_existing_user(amount=1, language="zh")
# -*- coding:utf-8 -*-
##############################################################################
#
# Copyright (c) 2019 Nexedi SA and Contributors. All Rights Reserved.
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from erp5.component.test.testSlapOSSubscriptionScenario import TestSlapOSSubscriptionScenarioMixin
#from erp5.component.test.SlapOSTestCaseMixin import changeSkin
class TestSlapOSSubscriptionCancellationScenario(TestSlapOSSubscriptionScenarioMixin):
def invokeBasicSimulationAlarmList(self):
# stabilise aggregated invoices and expand them
self.stepCallSlaposManageBuildingCalculatingDeliveryAlarm()
self.tic()
# update invoices with their tax & discount
self.stepCallSlaposTriggerBuildAlarm()
self.tic()
self.stepCallSlaposManageBuildingCalculatingDeliveryAlarm()
self.tic()
# update invoices with their tax & discount transaction lines
self.stepCallSlaposTriggerBuildAlarm()
self.tic()
self.stepCallSlaposManageBuildingCalculatingDeliveryAlarm()
self.tic()
# stop the invoices and solve them again
self.stepCallSlaposStopConfirmedAggregatedSaleInvoiceTransactionAlarm()
self.tic()
self.stepCallSlaposManageBuildingCalculatingDeliveryAlarm()
self.tic()
def test_subscription_scenario_reservation_cancellation_scenario(self):
self.subscription_server = self.createPublicServerForAdminUser()
# Call as anonymous... check response?
default_email_text = "abc%s@nexedi.com" % self.new_id
name="ABC %s" % self.new_id
amount = 1
self.logout()
user_input_dict = {
"name": name,
"amount" : amount}
self._requestSubscription(
subscription_reference=self.subscription_condition.getReference(),
user_input_dict=user_input_dict,
email=default_email_text,
confirmation_required=False)
self.login()
# I'm not sure if this is realistic
self.tic()
subscription_request = self.getSubscriptionRequest(
default_email_text, self.subscription_condition)
self.checkDraftSubscriptionRequest(subscription_request,
default_email_text, self.subscription_condition, amount=amount)
### Here all fine, Now let's consider the user never payed.
invoice = subscription_request.getCausalityValue(
portal_type="Sale Invoice Transaction")
self.assertEqual(invoice.getSimulationState(), "confirmed")
self.assertEqual(invoice.getCausalityState(), "building")
# Invoices are not payed!
payment_list = invoice.getCausalityRelatedValueList(portal_type="Payment Transaction")
self.assertEqual(len(payment_list), 1)
payment = payment_list[0]
self.assertEqual(payment.getSimulationState(), "started")
self.assertEqual(subscription_request.getSimulationState(), "draft")
self.invokeBasicSimulationAlarmList()
payment.cancel()
self.invokeBasicSimulationAlarmList()
# Call alarm to check payment and invoice and move foward to planned.
self.stepCallSlaposSubscriptionRequestProcessDraftAlarm()
self.tic()
payment_list = invoice.getCausalityRelatedValueList(portal_type="Payment Transaction")
self.assertEqual(len(payment_list), 1)
payment = payment_list[0]
self.assertEqual(payment.getSimulationState(), "cancelled")
# Alarm is conflicting
self.assertEqual(subscription_request.getSimulationState(), "cancelled")
def test_subscription_scenario_reservation_cancellation_late_alarm_scenario(self):
self.subscription_server = self.createPublicServerForAdminUser()
# Call as anonymous... check response?
default_email_text = "abc%s@nexedi.com" % self.new_id
name="ABC %s" % self.new_id
amount = 1
self.logout()
user_input_dict = {
"name": name,
"amount" : amount}
self._requestSubscription(
subscription_reference=self.subscription_condition.getReference(),
user_input_dict=user_input_dict,
email=default_email_text,
confirmation_required=False)
self.login()
# I'm not sure if this is realistic
self.tic()
subscription_request = self.getSubscriptionRequest(
default_email_text, self.subscription_condition)
self.checkDraftSubscriptionRequest(subscription_request,
default_email_text, self.subscription_condition, amount=amount)
### Here all fine, Now let's consider the user never payed.
invoice = subscription_request.getCausalityValue(
portal_type="Sale Invoice Transaction")
self.assertEqual(invoice.getSimulationState(), "confirmed")
self.assertEqual(invoice.getCausalityState(), "building")
# Invoices are not payed!
payment_list = invoice.getCausalityRelatedValueList(portal_type="Payment Transaction")
self.assertEqual(len(payment_list), 1)
payment = payment_list[0]
self.assertEqual(payment.getSimulationState(), "started")
self.assertEqual(subscription_request.getSimulationState(), "draft")
self.invokeBasicSimulationAlarmList()
# stop the invoices and solve them again
self.stepCallSlaposStopConfirmedAggregatedSaleInvoiceTransactionAlarm()
self.tic()
self.stepCallSlaposManageBuildingCalculatingDeliveryAlarm()
self.tic()
self.invokeBasicSimulationAlarmList()
self.assertEqual(invoice.getSimulationState(), "stopped")
self.assertEqual(invoice.getCausalityState(), "solved")
self.assertEqual(payment.getSimulationState(), "started")
# Cancel Payment and ensure all is cancelled along
payment.cancel()
self.assertEqual(payment.getSimulationState(), "cancelled")
self.tic()
self.assertEqual(invoice.getSimulationState(), "stopped")
self.assertEqual(invoice.getCausalityState(), "solved")
self.invokeBasicSimulationAlarmList()
# Call alarm to check payment and invoice and move foward to planned.
self.stepCallSlaposSubscriptionRequestProcessDraftAlarm()
self.tic()
payment_list = invoice.getCausalityRelatedValueList(portal_type="Payment Transaction")
self.assertEqual(len(payment_list), 1)
payment = payment_list[0]
self.assertEqual(payment.getSimulationState(), "cancelled")
self.assertEqual(invoice.getSimulationState(), "cancelled")
# Alarm is conflicting
self.assertEqual(subscription_request.getSimulationState(), "cancelled")
# -*- coding:utf-8 -*-
##############################################################################
#
# Copyright (c) 2019 Nexedi SA and Contributors. All Rights Reserved.
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from erp5.component.test.testSlapOSSubscriptionScenario import TestSlapOSSubscriptionScenarioMixin
from erp5.component.test.SlapOSTestCaseMixin import changeSkin
class TestSlapOSSubscriptionChineseScenarioMixin(TestSlapOSSubscriptionScenarioMixin):
def afterSetUp(self):
self.expected_slapos_organisation = self.expected_zh_slapos_organisation
TestSlapOSSubscriptionScenarioMixin.afterSetUp(self)
self.expected_price_currency = "currency_module/CNY"
self.normal_user = None
self.expected_notification_language = "zh"
self.login()
@changeSkin('Hal')
def _requestSubscription(self, **kw):
return self._requestSubscriptionViaChineseWebsite(**kw)
def createSubscriptionCondition(self, slave=False):
self.subscription_condition = self.createChineseSubscriptionCondition(
slave=slave)
class TestSlapOSSubscriptionChineseScenario(TestSlapOSSubscriptionChineseScenarioMixin):
def test_subscription_scenario_with_single_vm(self):
self._test_subscription_scenario(amount=1)
def test_subscription_with_3_vms_scenario(self):
self._test_subscription_scenario(amount=3)
def test_subscription_scenario_with_reversal_transaction(self):
self._test_subscription_scenario_with_reversal_transaction(amount=1)
def test_two_subscription_scenario(self):
self._test_two_subscription_scenario(amount=1)
def test_subscription_scenario_with_existing_user(self):
self._test_subscription_scenario_with_existing_user(amount=1, language="zh")
def test_subscription_scenario_with_existing_user_with_non_subscription_request(self):
self._test_subscription_scenario_with_existing_user_with_non_subscription_request(amount=1, language="en")
def test_subscription_scenario_with_existing_english_user(self):
# Messages are in chinese, when subscribed via chinese website. Even if the english language is
# english
self._test_subscription_scenario_with_existing_user(amount=1, language="en")
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testSlapOSSubscriptionDualOrganisationScenario</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testSlapOSSubscriptionDualOrganisationScenario</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
# -*- coding:utf-8 -*-
##############################################################################
#
# Copyright (c) 2019 Nexedi SA and Contributors. All Rights Reserved.
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from erp5.component.test.testSlapOSSubscriptionChineseScenario import TestSlapOSSubscriptionChineseScenarioMixin
class testSlapOSSubscriptionCloudInvitationTokenScenario(TestSlapOSSubscriptionChineseScenarioMixin):
def test_subscription_scenario_with_single_vm_and_empty_invitation(self):
self.cloud_invitation_token = self.makeCloudInvitationToken()
self._test_subscription_scenario(amount=1)
def test_subscription_with_3_vms_scenario_and_empty_invitation(self):
self.cloud_invitation_token = self.makeCloudInvitationToken()
self._test_subscription_scenario(amount=3)
def test_subscription_scenario_with_reversal_transaction_and_empty_invitation(self):
self.cloud_invitation_token = self.makeCloudInvitationToken()
self._test_subscription_scenario_with_reversal_transaction(amount=1)
def test_two_subscription_scenario_and_empty_invitation(self):
self._test_two_subscription_scenario(amount=1)
def test_subscription_scenario_with_existing_user_and_empty_invitation(self):
self.cloud_invitation_token = self.makeCloudInvitationToken()
self._test_subscription_scenario_with_existing_user(amount=1, language="zh")
def test_subscription_scenario_with_existing_user_with_non_subscription_request_with_empty_invitation(self):
self.cloud_invitation_token = self.makeCloudInvitationToken()
self._test_subscription_scenario_with_existing_user_with_non_subscription_request(amount=1, language="en")
def test_subscription_scenario_with_existing_english_user_and_empty_invitation(self):
self.cloud_invitation_token = self.makeCloudInvitationToken()
self._test_subscription_scenario_with_existing_user(amount=1, language="en")
def _init_test_with_valid_invitation(self):
self.expected_reservation_fee = 0.0
self.expected_reservation_fee_without_tax = 0.0
self.expected_reservation_quantity_tax = 0.0
self.expected_reservation_tax = 0.0
self.expected_free_reservation = 1
self.expected_zh_reservation_fee = 0.0
self.expected_zh_reservation_fee_without_tax = 0.0
self.expected_zh_reservation_quantity_tax = 0.0
self.expected_zh_reservation_tax = 0.0
self.expected_zh_free_reservation = 1
self.cloud_invitation_token = self.makeCloudInvitationToken(
max_invoice_delay=99,
max_invoice_credit_eur=900,
max_invoice_credit_cny=90000)
def test_subscription_scenario_with_single_vm_with_invitation(self):
self._init_test_with_valid_invitation()
self._test_subscription_scenario(amount=1)
def test_subscription_with_3_vms_scenario_with_invitation(self):
self._init_test_with_valid_invitation()
self._test_subscription_scenario(amount=3)
def test_subscription_scenario_with_reversal_transaction_with_invitation(self):
self._init_test_with_valid_invitation()
self._test_subscription_scenario_with_reversal_transaction(amount=1)
def test_two_subscription_scenario_with_invitation(self):
self.expected_reservation_fee = 0.0
self.expected_reservation_fee_without_tax = 0.0
self.expected_reservation_quantity_tax = 0.0
self.expected_reservation_tax = 0.0
self.expected_free_reservation = 1
self.expected_zh_reservation_fee = 0.0
self.expected_zh_reservation_fee_without_tax = 0.0
self.expected_zh_reservation_quantity_tax = 0.0
self.expected_zh_reservation_tax = 0.0
self.expected_zh_free_reservation = 1
self._test_two_subscription_scenario(amount=1,
create_invitation=True,
max_invoice_delay=99,
max_invoice_credit_eur=900,
max_invoice_credit_cny=90000
)
def test_subscription_scenario_with_existing_user_with_invitation(self):
self._init_test_with_valid_invitation()
self._test_subscription_scenario_with_existing_user(amount=1, language="zh")
def test_subscription_scenario_with_existing_english_user_with_invitation(self):
self._init_test_with_valid_invitation()
self._test_subscription_scenario_with_existing_user(amount=1, language="en")
def test_subscription_scenario_with_existing_user_with_non_subscription_request_with_token(self):
self._init_test_with_valid_invitation()
self._test_subscription_scenario_with_existing_user_with_non_subscription_request(amount=1, language="en")
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testSlapOSSubscriptionInvitationTokenChineseScenario</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testSlapOSSubscriptionInvitationTokenChineseScenario</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
# -*- coding:utf-8 -*-
##############################################################################
#
# Copyright (c) 2019 Nexedi SA and Contributors. All Rights Reserved.
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from erp5.component.test.testSlapOSSubscriptionScenario import TestSlapOSSubscriptionScenarioMixin
class testSlapOSSubscriptionCloudInvitationTokenScenario(TestSlapOSSubscriptionScenarioMixin):
def test_subscription_scenario_with_single_vm_and_empty_invitation(self):
self.cloud_invitation_token = self.makeCloudInvitationToken()
self._test_subscription_scenario(amount=1)
def test_subscription_with_3_vms_scenario_and_empty_invitation(self):
self.cloud_invitation_token = self.makeCloudInvitationToken()
self._test_subscription_scenario(amount=3)
def test_subscription_scenario_with_reversal_transaction_and_empty_invitation(self):
self.cloud_invitation_token = self.makeCloudInvitationToken()
self._test_subscription_scenario_with_reversal_transaction(amount=1)
def test_two_subscription_scenario_and_empty_invitation(self):
self._test_two_subscription_scenario(amount=1)
def test_subscription_scenario_with_existing_user_and_empty_invitation(self):
self.cloud_invitation_token = self.makeCloudInvitationToken()
self._test_subscription_scenario_with_existing_user(amount=1, language="zh")
def test_subscription_scenario_with_existing_user_with_non_subscription_request_with_empty_invitation(self):
self.cloud_invitation_token = self.makeCloudInvitationToken()
self._test_subscription_scenario_with_existing_user_with_non_subscription_request(amount=1, language="en")
def test_subscription_scenario_with_existing_english_user_and_empty_invitation(self):
self.cloud_invitation_token = self.makeCloudInvitationToken()
self._test_subscription_scenario_with_existing_user(amount=1, language="en")
def _init_test_with_valid_invitation(self):
self.expected_reservation_fee_without_tax = 0.0
self.expected_reservation_fee = 0.0
self.expected_reservation_quantity_tax = 0.0
self.expected_reservation_tax = 0.0
self.expected_free_reservation = 1
self.cloud_invitation_token = self.makeCloudInvitationToken(
max_invoice_delay=99,
max_invoice_credit_eur=900,
max_invoice_credit_cny=900)
def test_subscription_scenario_with_single_vm_with_invitation(self):
self._init_test_with_valid_invitation()
self._test_subscription_scenario(amount=1)
def test_subscription_with_3_vms_scenario_with_invitation(self):
self._init_test_with_valid_invitation()
self._test_subscription_scenario(amount=3)
def test_subscription_scenario_with_reversal_transaction_with_invitation(self):
self._init_test_with_valid_invitation()
self._test_subscription_scenario_with_reversal_transaction(amount=1)
def test_two_subscription_scenario_with_invitation(self):
self.expected_reservation_fee_without_tax = 0.0
self.expected_reservation_fee = 0.0
self.expected_reservation_quantity_tax = 0.0
self.expected_reservation_tax = 0.0
self.expected_free_reservation = 1
self._test_two_subscription_scenario(amount=1,
create_invitation=True,
max_invoice_delay=99,
max_invoice_credit_eur=900,
max_invoice_credit_cny=900
)
def test_subscription_scenario_with_existing_user_with_invitation(self):
self._init_test_with_valid_invitation()
self._test_subscription_scenario_with_existing_user(amount=1, language="zh")
def test_subscription_scenario_with_existing_english_user_with_invitation(self):
self._init_test_with_valid_invitation()
self._test_subscription_scenario_with_existing_user(amount=1, language="en")
def test_subscription_scenario_with_existing_user_with_non_subscription_request_with_token(self):
self._init_test_with_valid_invitation()
self._test_subscription_scenario_with_existing_user_with_non_subscription_request(amount=1, language="en")
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testSlapOSSubscriptionInvitationTokenScenario</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testSlapOSSubscriptionInvitationTokenScenario</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
# -*- coding:utf-8 -*-
##############################################################################
#
# Copyright (c) 2019 Nexedi SA and Contributors. All Rights Reserved.
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from erp5.component.test.testSlapOSSubscriptionChineseScenario import TestSlapOSSubscriptionChineseScenarioMixin
class testSlapOSSubscriptionNewTemplateChineseScenario(TestSlapOSSubscriptionChineseScenarioMixin):
def afterSetUp(self):
TestSlapOSSubscriptionChineseScenarioMixin.afterSetUp(self)
organisation = self.redefineAccountingTemplatesonPreferences(
price_currency="currency_module/CNY")
self.expected_source = organisation.getRelativeUrl()
self.expected_source_section = organisation.getRelativeUrl()
self.subscription_condition.getSpecialiseValue().edit(
source=self.expected_source,
source_section=self.expected_source_section,
source_payment=self.expected_source_section + '/bank_account',
)
self.portal.portal_caches.clearAllCache()
self.tic()
def beforeTearDown(self):
TestSlapOSSubscriptionChineseScenarioMixin.beforeTearDown(self)
self.restoreAccountingTemplatesOnPreferences()
self.portal.portal_caches.clearAllCache()
self.tic()
def test_subscription_scenario_with_single_vm(self):
self._test_subscription_scenario(amount=1)
def test_subscription_with_3_vms_scenario(self):
self._test_subscription_scenario(amount=3)
def test_subscription_scenario_with_reversal_transaction(self):
self._test_subscription_scenario_with_reversal_transaction(amount=1)
def test_two_subscription_scenario(self):
self._test_two_subscription_scenario(amount=1)
def test_subscription_scenario_with_existing_user(self):
self._test_subscription_scenario_with_existing_user(amount=1, language="zh")
def test_subscription_scenario_with_existing_user_with_non_subscription_request(self):
self._test_subscription_scenario_with_existing_user_with_non_subscription_request(amount=1, language="zh")
def test_subscription_scenario_with_existing_english_user(self):
# Messages are in chinese, when subscribed via chinese website. Even if the english language is
# english
self._test_subscription_scenario_with_existing_user(amount=1, language="en")
\ No newline at end of file
# -*- coding:utf-8 -*-
##############################################################################
#
# Copyright (c) 2019 Nexedi SA and Contributors. All Rights Reserved.
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from erp5.component.test.testSlapOSSubscriptionScenario import TestSlapOSSubscriptionScenarioMixin
class testSlapOSSubscriptionNewTemplateScenario(TestSlapOSSubscriptionScenarioMixin):
def afterSetUp(self):
TestSlapOSSubscriptionScenarioMixin.afterSetUp(self)
organisation = self.redefineAccountingTemplatesonPreferences()
self.expected_source = organisation.getRelativeUrl()
self.expected_source_section = organisation.getRelativeUrl()
self.subscription_condition.getSpecialiseValue().edit(
source=self.expected_source,
source_section=self.expected_source_section,
source_payment=self.expected_source_section + '/bank_account',
)
self.portal.portal_caches.clearAllCache()
self.tic()
def beforeTearDown(self):
TestSlapOSSubscriptionScenarioMixin.beforeTearDown(self)
self.restoreAccountingTemplatesOnPreferences()
self.portal.portal_caches.clearAllCache()
self.tic()
def test_subscription_scenario_with_single_vm(self):
self._test_subscription_scenario(amount=1)
def test_subscription_with_3_vms_scenario(self):
self._test_subscription_scenario(amount=3)
def test_subscription_scenario_with_reversal_transaction(self):
self._test_subscription_scenario_with_reversal_transaction(amount=1)
def test_two_subscription_scenario(self):
self._test_two_subscription_scenario(amount=1)
def test_subscription_scenario_with_existing_user(self):
self._test_subscription_scenario_with_existing_user(amount=1, language="zh")
def test_subscription_scenario_with_existing_user_with_non_subscription_request(self):
self._test_subscription_scenario_with_existing_user_with_non_subscription_request(amount=1, language="zh")
def test_subscription_scenario_with_existing_english_user(self):
# Messages are in chinese, when subscribed via chinese website. Even if the english language is
# english
self._test_subscription_scenario_with_existing_user(amount=1, language="en")
if alarm.getParentValue().isSubscribed() and not alarm.isActive() and alarm.isEnabled():
alarm.activate(queue='SQLQueue', **activate_kw).activeSense()
base = state_change['object']
portal = base.getPortalObject()
tag = script.id
base.reindexObject(activate_kw={'tag': tag})
context.Alarm_safeTrigger(portal.portal_alarms.slapos_subscription_request_create_from_orphaned_item, {'after_tag': tag})
base = state_change['object']
portal = base.getPortalObject()
tag = script.id
base.reindexObject(activate_kw={'tag': tag})
context.Alarm_safeTrigger(portal.portal_alarms.slapos_subscription_request_validate_submitted, {'after_tag': tag})
...@@ -42,15 +42,17 @@ ...@@ -42,15 +42,17 @@
<item> <item>
<key> <string>guard_permission</string> </key> <key> <string>guard_permission</string> </key>
<value> <value>
<tuple> <tuple/>
<string>Modify portal content</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
<key> <string>guard_role</string> </key> <key> <string>guard_role</string> </key>
<value> <value>
<tuple/> <tuple>
<string>Owner</string>
<string>Assignee</string>
<string>Assignor</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
......
...@@ -39,6 +39,16 @@ ...@@ -39,6 +39,16 @@
<tuple/> <tuple/>
</value> </value>
</item> </item>
<item>
<key> <string>guard_role</string> </key>
<value>
<tuple>
<string>Owner</string>
<string>Assignee</string>
<string>Assignor</string>
</tuple>
</value>
</item>
<item> <item>
<key> <string>icon</string> </key> <key> <string>icon</string> </key>
<value> <value>
......
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