Commit 56db2a38 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_accounting&subscription_request: User-specific Trade Condition Support

parent d7099508
...@@ -7,22 +7,53 @@ ...@@ -7,22 +7,53 @@
<pickle> <pickle>
<dictionary> <dictionary>
<item> <item>
<key> <string>_identity_criterion</string> </key> <key> <string>_count</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>_range_criterion</string> </key> <key> <string>_identity_criterion</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent>
</value>
</item>
<item>
<key> <string>base_price</string> </key>
<value> <float>25.0</float> </value>
</item>
<item>
<key> <string>base_price_per_slice</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>base_unit_price</string> </key>
<value> <float>0.0</float> </value>
</item>
<item> <item>
<key> <string>categories</string> </key> <key> <string>categories</string> </key>
<value> <value>
<tuple> <tuple>
<string>resource/service_module/slapos_instance_subscription</string> <string>resource/service_module/slapos_reservation_fee</string>
<string>price_currency/currency_module/EUR</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -34,7 +65,13 @@ ...@@ -34,7 +65,13 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>2</string> </value> <value> <string>4</string> </value>
</item>
<item>
<key> <string>index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAc=</string> </persistent>
</value>
</item> </item>
<item> <item>
<key> <string>mapped_value_property_list</string> </key> <key> <string>mapped_value_property_list</string> </key>
...@@ -53,6 +90,14 @@ ...@@ -53,6 +90,14 @@
</tuple> </tuple>
</value> </value>
</item> </item>
<item>
<key> <string>p_variation_base_category</string> </key>
<value>
<tuple>
<string>variation</string>
</tuple>
</value>
</item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
<value> <string>Sale Supply Line</string> </value> <value> <string>Sale Supply Line</string> </value>
...@@ -60,13 +105,19 @@ ...@@ -60,13 +105,19 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAg=</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="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -81,7 +132,15 @@ ...@@ -81,7 +132,15 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -96,7 +155,37 @@ ...@@ -96,7 +155,37 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="4" aka="AAAAAAAAAAQ="> <record id="6" aka="AAAAAAAAAAY=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="7" aka="AAAAAAAAAAc=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>path</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAk=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="8" aka="AAAAAAAAAAg=">
<pickle> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -109,7 +198,7 @@ ...@@ -109,7 +198,7 @@
<item> <item>
<key> <string>edit_workflow</string> </key> <key> <string>edit_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAo=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -118,7 +207,29 @@ ...@@ -118,7 +207,29 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="5" aka="AAAAAAAAAAU="> <record id="9" aka="AAAAAAAAAAk=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <int>0</int> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAs=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="10" aka="AAAAAAAAAAo=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
...@@ -149,7 +260,7 @@ ...@@ -149,7 +260,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>989.57955.38476.51182</string> </value> <value> <string>992.63001.55132.4829</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -167,7 +278,7 @@ ...@@ -167,7 +278,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1612806017.07</float> <float>1624560648.64</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
...@@ -181,4 +292,32 @@ ...@@ -181,4 +292,32 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="11" aka="AAAAAAAAAAs=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>variation/service_module/slapos_reservation_fee/1</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>variation/service_module/slapos_reservation_fee/3</string> </key>
<value> <int>2</int> </value>
</item>
<item>
<key> <string>variation/service_module/slapos_reservation_fee/default</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Sale Supply Cell" 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>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>base_id</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>base_id</string> </key>
<value> <string>path</string> </value>
</item>
<item>
<key> <string>base_price</string> </key>
<value> <float>1.0</float> </value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>variation/service_module/slapos_reservation_fee/1</string>
</tuple>
</value>
</item>
<item>
<key> <string>criterion_property</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>path_0</string> </value>
</item>
<item>
<key> <string>mapped_value_property_list</string> </key>
<value>
<tuple>
<string>base_price</string>
<string>base_unit_price</string>
<string>slice_base_price</string>
<string>slice_quantity_range</string>
</tuple>
</value>
</item>
<item>
<key> <string>membership_criterion_base_category</string> </key>
<value>
<tuple>
<string>variation</string>
</tuple>
</value>
</item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple>
<string>variation/service_module/slapos_reservation_fee/1</string>
</tuple>
</value>
</item>
<item>
<key> <string>multimembership_criterion_base_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Sale Supply Cell</string> </value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</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="Sale Supply Cell" 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>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>base_id</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>base_id</string> </key>
<value> <string>path</string> </value>
</item>
<item>
<key> <string>base_price</string> </key>
<value> <float>25.0</float> </value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>variation/service_module/slapos_reservation_fee/default</string>
</tuple>
</value>
</item>
<item>
<key> <string>criterion_property</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>path_1</string> </value>
</item>
<item>
<key> <string>mapped_value_property_list</string> </key>
<value>
<tuple>
<string>base_price</string>
<string>base_unit_price</string>
<string>slice_base_price</string>
<string>slice_quantity_range</string>
</tuple>
</value>
</item>
<item>
<key> <string>membership_criterion_base_category</string> </key>
<value>
<tuple>
<string>variation</string>
</tuple>
</value>
</item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple>
<string>variation/service_module/slapos_reservation_fee/default</string>
</tuple>
</value>
</item>
<item>
<key> <string>multimembership_criterion_base_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Sale Supply Cell</string> </value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</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="Sale Supply Cell" 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>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>base_id</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>base_id</string> </key>
<value> <string>path</string> </value>
</item>
<item>
<key> <string>base_price</string> </key>
<value> <float>65.0</float> </value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>variation/service_module/slapos_reservation_fee/3</string>
</tuple>
</value>
</item>
<item>
<key> <string>criterion_property</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>path_2</string> </value>
</item>
<item>
<key> <string>mapped_value_property_list</string> </key>
<value>
<tuple>
<string>base_price</string>
<string>base_unit_price</string>
<string>slice_base_price</string>
<string>slice_quantity_range</string>
</tuple>
</value>
</item>
<item>
<key> <string>membership_criterion_base_category</string> </key>
<value>
<tuple>
<string>variation</string>
</tuple>
</value>
</item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple>
<string>variation/service_module/slapos_reservation_fee/3</string>
</tuple>
</value>
</item>
<item>
<key> <string>multimembership_criterion_base_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Sale Supply Cell</string> </value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</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="Sale Supply Cell" 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>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>base_id</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>base_id</string> </key>
<value> <string>path</string> </value>
</item>
<item>
<key> <string>base_price</string> </key>
<value> <float>8.0</float> </value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>variation/service_module/slapos_reservation_fee/1</string>
</tuple>
</value>
</item>
<item>
<key> <string>criterion_property</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>path_0</string> </value>
</item>
<item>
<key> <string>mapped_value_property_list</string> </key>
<value>
<tuple>
<string>base_price</string>
<string>base_unit_price</string>
<string>slice_base_price</string>
<string>slice_quantity_range</string>
</tuple>
</value>
</item>
<item>
<key> <string>membership_criterion_base_category</string> </key>
<value>
<tuple>
<string>variation</string>
</tuple>
</value>
</item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple>
<string>variation/service_module/slapos_reservation_fee/1</string>
</tuple>
</value>
</item>
<item>
<key> <string>multimembership_criterion_base_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Sale Supply Cell</string> </value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</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="Sale Supply Cell" 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>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>base_id</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>base_id</string> </key>
<value> <string>path</string> </value>
</item>
<item>
<key> <string>base_price</string> </key>
<value> <float>188.0</float> </value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>variation/service_module/slapos_reservation_fee/default</string>
</tuple>
</value>
</item>
<item>
<key> <string>criterion_property</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>path_1</string> </value>
</item>
<item>
<key> <string>mapped_value_property_list</string> </key>
<value>
<tuple>
<string>base_price</string>
<string>base_unit_price</string>
<string>slice_base_price</string>
<string>slice_quantity_range</string>
</tuple>
</value>
</item>
<item>
<key> <string>membership_criterion_base_category</string> </key>
<value>
<tuple>
<string>variation</string>
</tuple>
</value>
</item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple>
<string>variation/service_module/slapos_reservation_fee/default</string>
</tuple>
</value>
</item>
<item>
<key> <string>multimembership_criterion_base_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Sale Supply Cell</string> </value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</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="Sale Supply Cell" 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>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>base_id</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>string</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>_range_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>base_id</string> </key>
<value> <string>path</string> </value>
</item>
<item>
<key> <string>base_price</string> </key>
<value> <float>488.0</float> </value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>variation/service_module/slapos_reservation_fee/3</string>
</tuple>
</value>
</item>
<item>
<key> <string>criterion_property</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>path_2</string> </value>
</item>
<item>
<key> <string>mapped_value_property_list</string> </key>
<value>
<tuple>
<string>base_price</string>
<string>base_unit_price</string>
<string>slice_base_price</string>
<string>slice_quantity_range</string>
</tuple>
</value>
</item>
<item>
<key> <string>membership_criterion_base_category</string> </key>
<value>
<tuple>
<string>variation</string>
</tuple>
</value>
</item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple>
<string>variation/service_module/slapos_reservation_fee/3</string>
</tuple>
</value>
</item>
<item>
<key> <string>multimembership_criterion_base_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Sale Supply Cell</string> </value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</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>
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</item> </item>
<item> <item>
<key> <string>expression</string> </key> <key> <string>expression</string> </key>
<value> <string>python: object.getSpecialise() in ["sale_trade_condition_module/slapos_aggregated_trade_condition", "sale_trade_condition_module/slapos_aggregated_subscription_trade_condition"]</string> </value> <value> <string>python: object.Base_testSlapOSValidTradeCondition()</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
portal = context.getPortalObject() portal = context.getPortalObject()
specialise_uid = [portal.restrictedTraverse(portal.portal_preferences.getPreferredAggregatedSaleTradeCondition()).getUid(), trade_condition_uid_list = []
portal.restrictedTraverse(portal.portal_preferences.getPreferredAggregatedSubscriptionSaleTradeCondition()).getUid()] root_trade_condition_uid_list = [
portal.restrictedTraverse(
portal.portal_preferences.getPreferredAggregatedSubscriptionSaleTradeCondition()).getUid(),
portal.restrictedTraverse(
portal.portal_preferences.getPreferredAggregatedSaleTradeCondition()).getUid()]
trade_condition_uid_list.extend(root_trade_condition_uid_list)
trade_condition_uid_list.extend([
i.uid for i in portal.portal_catalog(
specialise__uid=root_trade_condition_uid_list,
validation_state="validated")])
portal.portal_catalog.searchAndActivate( portal.portal_catalog.searchAndActivate(
portal_type='Sale Packing List', portal_type='Sale Packing List',
simulation_state='started', simulation_state='started',
causality_state='solved', causality_state='solved',
specialise_uid=specialise_uid, specialise_uid=trade_condition_uid_list,
method_id='Delivery_deliverStartedAggregatedSalePackingList', method_id='Delivery_deliverStartedAggregatedSalePackingList',
activate_kw={'tag': tag}, activate_kw={'tag': tag},
) )
......
...@@ -2,14 +2,26 @@ if params is None: ...@@ -2,14 +2,26 @@ if params is None:
params = {} params = {}
from DateTime import DateTime from DateTime import DateTime
portal = context.getPortalObject() portal = context.getPortalObject()
trade_condition_uid_list = []
root_trade_condition_value = portal.restrictedTraverse(
portal.portal_preferences.getPreferredAggregatedSubscriptionSaleTradeCondition())
root_trade_condition_uid = root_trade_condition_value.getUid()
trade_condition_uid_list.append(root_trade_condition_uid)
trade_condition_uid_list.extend([
i.uid for i in portal.portal_catalog(
portal_type=root_trade_condition_value.getPortalType(),
specialise__uid=root_trade_condition_uid,
validation_state="validated")])
portal.portal_catalog.searchAndActivate( portal.portal_catalog.searchAndActivate(
portal_type='Sale Packing List', portal_type='Sale Packing List',
simulation_state='confirmed', simulation_state='confirmed',
causality_state='solved', causality_state='solved',
specialise_uid=portal.restrictedTraverse( specialise__uid=trade_condition_uid_list,
portal.portal_preferences.getPreferredAggregatedSubscriptionSaleTradeCondition()).getUid(),
method_id='Delivery_startConfirmedAggregatedSalePackingList', method_id='Delivery_startConfirmedAggregatedSalePackingList',
activate_kw={'tag': tag}, activate_kw={'tag': tag},
) )
......
from DateTime import DateTime from DateTime import DateTime
portal = context.getPortalObject() portal = context.getPortalObject()
specialise_uid = [portal.restrictedTraverse(portal.portal_preferences.getPreferredAggregatedSaleTradeCondition()).getUid(),
portal.restrictedTraverse(portal.portal_preferences.getPreferredAggregatedSubscriptionSaleTradeCondition()).getUid()]
trade_condition_uid_list = []
# search for user specific trade conditions
root_trade_condition_uid_list = [
portal.restrictedTraverse(
portal.portal_preferences.getPreferredAggregatedSubscriptionSaleTradeCondition()).getUid(),
portal.restrictedTraverse(
portal.portal_preferences.getPreferredAggregatedSaleTradeCondition()).getUid()]
trade_condition_uid_list.extend(root_trade_condition_uid_list)
trade_condition_uid_list.extend([
i.uid for i in portal.portal_catalog(
portal_type="Sale Trade Condition",
specialise__uid=root_trade_condition_uid_list,
validation_state="validated")])
portal.portal_catalog.searchAndActivate( portal.portal_catalog.searchAndActivate(
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
simulation_state='confirmed', simulation_state='confirmed',
causality_state='solved', causality_state='solved',
specialise_uid=specialise_uid, specialise__uid=trade_condition_uid_list,
method_id='Delivery_stopConfirmedAggregatedSaleInvoiceTransaction', method_id='Delivery_stopConfirmedAggregatedSaleInvoiceTransaction',
activate_kw={'tag': tag} activate_kw={'tag': tag}
) )
......
root_trade_condition_list = ["sale_trade_condition_module/slapos_aggregated_trade_condition",
"sale_trade_condition_module/slapos_aggregated_subscription_trade_condition"]
if context.getSpecialise() in root_trade_condition_list:
return True
portal = context.getPortalObject()
specialise_uid = [
portal.restrictedTraverse(i).getUid() for i in root_trade_condition_list
]
return context.getSpecialiseUid() in [
i.uid for i in portal.portal_catalog(
portal_type="Sale Trade Condition",
specialise__uid=specialise_uid,
validation_state="validated")]
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_testSlapOSValidTradeCondition</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -5,9 +5,29 @@ if context.getPortalType() != 'Sale Packing List': ...@@ -5,9 +5,29 @@ if context.getPortalType() != 'Sale Packing List':
isTransitionPossible = portal.portal_workflow.isTransitionPossible isTransitionPossible = portal.portal_workflow.isTransitionPossible
if context.getSimulationState() == 'started' \ if context.getSimulationState() == 'started' \
and len(context.checkConsistency()) == 0 \ and len(context.checkConsistency()) == 0 \
and context.getCausalityState() == 'solved' \ and context.getCausalityState() == 'solved':
and context.getSpecialise() in [portal.portal_preferences.getPreferredAggregatedSaleTradeCondition(),
if context.getSpecialise() not in [
portal.portal_preferences.getPreferredAggregatedSaleTradeCondition(),
portal.portal_preferences.getPreferredAggregatedSubscriptionSaleTradeCondition()]: portal.portal_preferences.getPreferredAggregatedSubscriptionSaleTradeCondition()]:
trade_condition_uid_list = []
# search for user specific trade conditions
root_trade_condition_uid_list = [
portal.restrictedTraverse(
portal.portal_preferences.getPreferredAggregatedSubscriptionSaleTradeCondition()).getUid(),
portal.restrictedTraverse(
portal.portal_preferences.getPreferredAggregatedSaleTradeCondition()).getUid()]
trade_condition_uid_list.extend(root_trade_condition_uid_list)
trade_condition_uid_list.extend([
i.uid for i in portal.portal_catalog(
specialise__uid=root_trade_condition_uid_list,
validation_state="validated")])
if context.getSpecialiseUid() not in trade_condition_uid_list:
return
comment = 'Delivered by alarm as all actions in started state are ready.' comment = 'Delivered by alarm as all actions in started state are ready.'
if isTransitionPossible(context, 'stop'): if isTransitionPossible(context, 'stop'):
context.stop(comment=comment) context.stop(comment=comment)
......
...@@ -2,13 +2,35 @@ from DateTime import DateTime ...@@ -2,13 +2,35 @@ from DateTime import DateTime
portal = context.getPortalObject() portal = context.getPortalObject()
if context.getPortalType() != 'Sale Packing List': if context.getPortalType() != 'Sale Packing List':
raise TypeError('Incorrect delivery.') raise TypeError('Incorrect delivery.')
isTransitionPossible = portal.portal_workflow.isTransitionPossible isTransitionPossible = portal.portal_workflow.isTransitionPossible
if context.getSimulationState() == 'confirmed' \ if context.getSimulationState() == 'confirmed' \
and len(context.checkConsistency()) == 0 \ and len(context.checkConsistency()) == 0 \
and context.getCausalityState() == 'solved' \ and context.getCausalityState() == 'solved':
and context.getSpecialise() in [portal.portal_preferences.getPreferredAggregatedSaleTradeCondition(),
if context.getSpecialise() not in [
portal.portal_preferences.getPreferredAggregatedSaleTradeCondition(),
portal.portal_preferences.getPreferredAggregatedSubscriptionSaleTradeCondition()]: portal.portal_preferences.getPreferredAggregatedSubscriptionSaleTradeCondition()]:
trade_condition_uid_list = []
# search for user specific trade conditions
root_trade_condition_uid_list = [
portal.restrictedTraverse(
portal.portal_preferences.getPreferredAggregatedSubscriptionSaleTradeCondition()).getUid(),
portal.restrictedTraverse(
portal.portal_preferences.getPreferredAggregatedSaleTradeCondition()).getUid()]
trade_condition_uid_list.extend(root_trade_condition_uid_list)
trade_condition_uid_list.extend([
i.uid for i in portal.portal_catalog(
specialise__uid=root_trade_condition_uid_list,
validation_state="validated")])
if context.getSpecialiseUid() not in trade_condition_uid_list:
return
comment = 'Start by alarm as all actions in confirmed state are ready.' comment = 'Start by alarm as all actions in confirmed state are ready.'
date = context.getStartDate() date = context.getStartDate()
if date is None: if date is None:
......
...@@ -5,9 +5,30 @@ isTransitionPossible = portal.portal_workflow.isTransitionPossible ...@@ -5,9 +5,30 @@ isTransitionPossible = portal.portal_workflow.isTransitionPossible
if context.getSimulationState() == 'confirmed'\ if context.getSimulationState() == 'confirmed'\
and len(context.checkConsistency()) == 0\ and len(context.checkConsistency()) == 0\
and context.getCausalityState() == 'solved'\ and context.getCausalityState() == 'solved'\
and len(context.objectValues(portal_type="Sale Invoice Transaction Line"))\ and len(context.objectValues(portal_type="Sale Invoice Transaction Line")):
and context.getSpecialise() in [portal.portal_preferences.getPreferredAggregatedSaleTradeCondition(),
if context.getSpecialise() not in [
portal.portal_preferences.getPreferredAggregatedSaleTradeCondition(),
portal.portal_preferences.getPreferredAggregatedSubscriptionSaleTradeCondition()]: portal.portal_preferences.getPreferredAggregatedSubscriptionSaleTradeCondition()]:
trade_condition_uid_list = []
# search for user specific trade conditions
root_trade_condition_uid_list = [
portal.restrictedTraverse(
portal.portal_preferences.getPreferredAggregatedSubscriptionSaleTradeCondition()).getUid(),
portal.restrictedTraverse(
portal.portal_preferences.getPreferredAggregatedSaleTradeCondition()).getUid()]
trade_condition_uid_list.extend(root_trade_condition_uid_list)
trade_condition_uid_list.extend([
i.uid for i in portal.portal_catalog(
portal_type="Sale Trade Condition",
specialise__uid=root_trade_condition_uid_list,
validation_state="validated")])
if context.getSpecialiseUid() not in trade_condition_uid_list:
return
comment = 'Stopped by alarm as all actions in confirmed state are ready.' comment = 'Stopped by alarm as all actions in confirmed state are ready.'
if isTransitionPossible(context, 'start'): if isTransitionPossible(context, 'start'):
context.start(comment=comment) context.start(comment=comment)
......
...@@ -84,9 +84,11 @@ for movement in movement_list: ...@@ -84,9 +84,11 @@ for movement in movement_list:
hosting_subscription = movement.getAggregateValue(portal_type="Hosting Subscription") hosting_subscription = movement.getAggregateValue(portal_type="Hosting Subscription")
specialise_to_set = subscription_request_specialise
if movement.getSpecialiseUid() in consumption_specialise_uid_list: if movement.getSpecialiseUid() in consumption_specialise_uid_list:
specialise_to_set = consumption_specialise specialise_to_set = consumption_specialise
else:
person = movement.getDestinationValue()
specialise_to_set = person.Person_getAggregatedSubscriptionSaleTradeConditionValue(subscription_request_specialise)
if hosting_subscription is not None: if hosting_subscription is not None:
subscription = hosting_subscription.getAggregateRelated(portal_type="Subscription Request") subscription = hosting_subscription.getAggregateRelated(portal_type="Subscription Request")
......
# Search by a trade condition that specialise to the root_trade_condition
# Which is user's specific.
# XXX This code is draft
portal = context.getPortalObject()
if root_trade_condition is None:
return root_trade_condition
root_trade_condition_value = portal.restrictedTraverse(root_trade_condition)
trade_condition = portal.portal_catalog.getResultValue(
portal_type=root_trade_condition_value.getPortalType(),
specialise__uid=root_trade_condition_value.getUid(),
validation_state=root_trade_condition_value.getValidationState(),
destination_section__uid=context.getUid()
)
if trade_condition is not None:
return trade_condition.getRelativeUrl()
return root_trade_condition
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>root_trade_condition</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Person_getAggregatedSubscriptionSaleTradeConditionValue</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
specialise = context.getSpecialiseValue(portal_type='Sale Trade Condition') specialise = context.getSpecialiseValue(portal_type='Sale Trade Condition')
amount_list = specialise.getAggregatedAmountList(context) amount_list = specialise.getAggregatedAmountList(context)
if len(amount_list) != 1: if len(amount_list) < 1:
return False return False
precision = context.getPriceCurrencyValue().getQuantityPrecision() precision = context.getPriceCurrencyValue().getQuantityPrecision()
......
...@@ -8,6 +8,14 @@ current_invoice = context.getCausalityValue() ...@@ -8,6 +8,14 @@ current_invoice = context.getCausalityValue()
if current_invoice is None: if current_invoice is None:
invoice_template = portal.restrictedTraverse(template) invoice_template = portal.restrictedTraverse(template)
current_invoice = invoice_template.Base_createCloneDocument(batch_mode=1) current_invoice = invoice_template.Base_createCloneDocument(batch_mode=1)
subscription_trade_condition = portal.portal_preferences.getPreferredAggregatedSubscriptionSaleTradeCondition()
user_trade_condition = context.getDestinationSectionValue().\
Person_getAggregatedSubscriptionSaleTradeConditionValue(subscription_trade_condition)
if user_trade_condition:
current_invoice.setSpecialise(user_trade_condition)
context.edit(causality_value=current_invoice) context.edit(causality_value=current_invoice)
payment_transaction = portal.restrictedTraverse(payment) payment_transaction = portal.restrictedTraverse(payment)
...@@ -31,6 +39,14 @@ if current_invoice is None: ...@@ -31,6 +39,14 @@ if current_invoice is None:
) )
cell.setPrice(price) cell.setPrice(price)
# Test to see if the user has specific trade condition for aggregation.
person = context.getDestinationSectionValue()
trade_condition = person.Person_getAggregatedSubscriptionSaleTradeConditionValue(
current_invoice.getSpecialise()
)
if trade_condition != current_invoice.getSpecialise():
current_invoice.edit(specialise=trade_condition)
comment = "Validation invoice for subscription request %s" % context.getRelativeUrl() comment = "Validation invoice for subscription request %s" % context.getRelativeUrl()
current_invoice.plan(comment=comment) current_invoice.plan(comment=comment)
current_invoice.confirm(comment=comment) current_invoice.confirm(comment=comment)
......
...@@ -32,7 +32,19 @@ if current_invoice is None: ...@@ -32,7 +32,19 @@ if current_invoice is None:
price = 0 price = 0
tax = 0 tax = 0
else: else:
invoice_line = invoice_template["1"].asContext() invoice_line = invoice_template["1"].asContext(
destination_section=context.getDestinationSection()
)
subscription_trade_condition = portal.portal_preferences.getPreferredAggregatedSubscriptionSaleTradeCondition()
user_trade_condition = context.getDestinationSectionValue().\
Person_getAggregatedSubscriptionSaleTradeConditionValue(subscription_trade_condition)
if user_trade_condition:
invoice_line.edit(
specialise=user_trade_condition,
destination_section=context.getDestinationSection())
resource = invoice_line.getResourceValue() resource = invoice_line.getResourceValue()
if variation_reference is not None: if variation_reference is not None:
for variation in resource.objectValues(portal_type="Service Individual Variation"): for variation in resource.objectValues(portal_type="Service Individual Variation"):
......
...@@ -7,29 +7,29 @@ reservation_fee_invoice = context.getCausalityValue( ...@@ -7,29 +7,29 @@ reservation_fee_invoice = context.getCausalityValue(
if reservation_fee_invoice is None: if reservation_fee_invoice is None:
return return
reservation_fee_total_price = reservation_fee_invoice.getTotalPrice() specialise_uid = portal.restrictedTraverse(
subscription_request_total_price = context.getPrice() * context.getQuantity() portal.portal_preferences.getPreferredAggregatedSubscriptionSaleTradeCondition()).getUid()
remaining_to_pay = subscription_request_total_price - reservation_fee_total_price trade_condition_uid_list = [specialise_uid]
trade_condition_uid_list.extend([
i.uid for i in portal.portal_catalog(
portal_type="Sale Trade Condition",
specialise__uid=specialise_uid,
validation_state="validated")])
# This is normally one, but we navegate in case # This is normally one, but we navegate in case
for packing_list in portal.portal_catalog( for packing_list in portal.portal_catalog(
portal_type="Sale Packing List", portal_type="Sale Packing List",
causality_uid=context.getUid(), causality_uid=context.getUid(),
specialise_uid=portal.restrictedTraverse( specialise_uid=trade_condition_uid_list
portal.portal_preferences.getPreferredAggregatedSubscriptionSaleTradeCondition()).getUid(),
): ):
for invoice in packing_list.getCausalityRelatedValueList( for invoice in packing_list.getCausalityRelatedValueList(
portal_type="Sale Invoice Transaction"): portal_type="Sale Invoice Transaction"):
for payment in invoice.getCausalityRelatedValueList( for payment in invoice.getCausalityRelatedValueList(
portal_type=["Payment Transaction", "Sale Invoice Transaction"]): portal_type=["Payment Transaction", "Sale Invoice Transaction"]):
if payment.getSimulationState() in ["stopped", "delivered"]: if payment.getSimulationState() in ["stopped", "delivered", "started"]:
# Invoice is already paied so we just move foward # Invoice is already paied so we just move foward
return payment if not payment.checkConsistency():
elif payment.getSimulationState() in ["started"]:
payment_total_price = payment.PaymentTransaction_getTotalPayablePrice()
if not(round(payment_total_price, 2) + round(remaining_to_pay, 2)):
# Payment contains the expected value
return payment return payment
# Payment isn't ready # Payment isn't ready
......
# -*- 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 testSlapOSSubscriptionPerUserTradeConditionScenario(TestSlapOSSubscriptionScenarioMixin):
def createCustomUserSaleTradeCondition(self, person):
root_trade_condition = self.portal.portal_preferences.\
getPreferredAggregatedSubscriptionSaleTradeCondition()
root_trade_condition_value = self.portal.restrictedTraverse(
root_trade_condition)
user_trade_condition = root_trade_condition_value.\
Base_createCloneDocument(batch_mode=1)
user_trade_condition.edit(
title="TEST Trade Condition for %s" % person.getTitle(),
reference="%s_custom_%s" % (user_trade_condition.getReference(), user_trade_condition.getUid()),
destination_section_value=person,
specialise=root_trade_condition
)
user_trade_condition.validate()
return user_trade_condition
def _test_subscription_scenario_with_custom_condition(self, amount=1, language=None):
""" The admin creates an computer, user can request instances on it"""
# Call as anonymous... check response?
default_email_text = "abc%s@nexedi.com" % self.new_id
name="ABC %s" % self.new_id
self.login()
self.createNormalUser(default_email_text, name, language)
self.createCustomUserSaleTradeCondition(self.normal_user)
self.tic()
self.subscription_server = self.createPublicServerForAdminUser()
self.requestAndCheckHostingSubscription(
amount, name, default_email_text)
self.checkSubscriptionDeploymentAndSimulation(
default_email_text, self.subscription_server)
subscription_request = self.getSubscriptionRequest(
default_email_text, self.subscription_condition)
self.assertEqual(self.normal_user,
subscription_request.getDestinationSectionValue())
self.destroyAndCheckSubscription(
default_email_text, self.subscription_server
)
return default_email_text, name
def test_custom_scenario(self):
self._test_subscription_scenario_with_custom_condition(amount=1, language="en")
class testSlapOSSubscriptionPerUserTradeConditionScenarioDetaxed(TestSlapOSSubscriptionScenarioMixin):
def afterSetUp(self):
TestSlapOSSubscriptionScenarioMixin.afterSetUp(self)
self.expected_individual_price_without_tax = 195
self.expected_individual_price_with_tax = 195
self.expected_reservation_fee = 25.00
self.expected_reservation_fee_without_tax = 25
self.expected_reservation_quantity_tax = 25
self.expected_reservation_tax = 0.0
self.expected_price_currency = "currency_module/EUR"
self.expected_zh_individual_price_without_tax = 1888
self.expected_zh_individual_price_with_tax = 1888
self.expected_zh_reservation_fee = 188
self.expected_zh_reservation_fee_without_tax = 188
self.expected_zh_reservation_quantity_tax = 188
self.expected_zh_reservation_tax = 0.0
def createDetaxedUserSaleTradeCondition(self, person):
root_trade_condition = self.portal.portal_preferences.\
getPreferredAggregatedSubscriptionSaleTradeCondition()
root_trade_condition_value = self.portal.restrictedTraverse(
root_trade_condition)
user_trade_condition = root_trade_condition_value.\
Base_createCloneDocument(batch_mode=1)
user_trade_condition.edit(
title="TEST Trade Condition for %s" % person.getTitle(),
reference="%s_detaxed_%s" % (user_trade_condition.getReference(), user_trade_condition.getUid()),
destination_section_value=person,
specialise=root_trade_condition
)
user_trade_condition["1"].setPrice(0.0)
user_trade_condition.validate()
return user_trade_condition
def _test_subscription_scenario_with_detaxed_condition(self, amount=1, language=None):
""" The admin creates an computer, user can request instances on it"""
# Call as anonymous... check response?
default_email_text = "abc%s@nexedi.com" % self.new_id
name="ABC %s" % self.new_id
self.login()
self.createNormalUser(default_email_text, name, language)
self.createDetaxedUserSaleTradeCondition(self.normal_user)
self.tic()
self.subscription_server = self.createPublicServerForAdminUser()
self.requestAndCheckHostingSubscription(
amount, name, default_email_text)
self.checkSubscriptionDeploymentAndSimulation(
default_email_text, self.subscription_server)
subscription_request = self.getSubscriptionRequest(
default_email_text, self.subscription_condition)
self.assertEqual(self.normal_user,
subscription_request.getDestinationSectionValue())
self.destroyAndCheckSubscription(
default_email_text, self.subscription_server
)
return default_email_text, name
def test_detaxed_scenario(self):
self._test_subscription_scenario_with_detaxed_condition(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>testSlapOSSubscriptionPerUserTradeConditionScenario</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.testSlapOSSubscriptionPerUserTradeConditionScenario</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>
...@@ -802,15 +802,16 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans ...@@ -802,15 +802,16 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
# check if Packing list is generated with the right trade condition # check if Packing list is generated with the right trade condition
preference_tool = self.portal.portal_preferences preference_tool = self.portal.portal_preferences
specialise_subscription_uid = preference_tool.getPreferredAggregatedSubscriptionSaleTradeCondition() aggregate_subscription_condition = \
specialise_uid = preference_tool.getPreferredAggregatedSaleTradeCondition() preference_tool.getPreferredAggregatedSubscriptionSaleTradeCondition()
trade_condition = preference_tool.getPreferredAggregatedSaleTradeCondition()
for subscription_request in subscription_request_list: for subscription_request in subscription_request_list:
sale_packing_list_list = self.getAggregatedSalePackingList( sale_packing_list_list = self.getAggregatedSalePackingList(
subscription_request, specialise_subscription_uid) subscription_request, aggregate_subscription_condition)
if not len(sale_packing_list_list): if not len(sale_packing_list_list):
diverged_sale_packing_list_list = self.getDivergedAggregatedSalePackingList( diverged_sale_packing_list_list = self.getDivergedAggregatedSalePackingList(
subscription_request, specialise_subscription_uid) subscription_request, aggregate_subscription_condition)
self.assertEqual(0, len(diverged_sale_packing_list_list)) self.assertEqual(0, len(diverged_sale_packing_list_list))
self.assertEqual(1, len(sale_packing_list_list)) self.assertEqual(1, len(sale_packing_list_list))
...@@ -824,7 +825,7 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans ...@@ -824,7 +825,7 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
len(self.getSubscriptionSalePackingList(subscription_request))) len(self.getSubscriptionSalePackingList(subscription_request)))
self.assertEqual(0, len(self.getAggregatedSalePackingList( self.assertEqual(0, len(self.getAggregatedSalePackingList(
subscription_request, specialise_uid))) subscription_request, trade_condition)))
# Call this alarm shouldn't affect the delivery # Call this alarm shouldn't affect the delivery
self.stepCallSlaposStartConfirmedAggregatedSalePackingListAlarm( self.stepCallSlaposStartConfirmedAggregatedSalePackingListAlarm(
...@@ -833,7 +834,7 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans ...@@ -833,7 +834,7 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
for subscription_request in subscription_request_list: for subscription_request in subscription_request_list:
self.assertEqual(1, len(self.getAggregatedSalePackingList( self.assertEqual(1, len(self.getAggregatedSalePackingList(
subscription_request, specialise_subscription_uid))) subscription_request, aggregate_subscription_condition)))
# Call this alarm shouldn't affect the delivery # Call this alarm shouldn't affect the delivery
self.stepCallSlaposStartConfirmedAggregatedSubscriptionSalePackingListAlarm() self.stepCallSlaposStartConfirmedAggregatedSubscriptionSalePackingListAlarm()
...@@ -841,7 +842,7 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans ...@@ -841,7 +842,7 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
for subscription_request in subscription_request_list: for subscription_request in subscription_request_list:
self.assertEqual(0, len(self.getAggregatedSalePackingList( self.assertEqual(0, len(self.getAggregatedSalePackingList(
subscription_request, specialise_uid))) subscription_request, trade_condition)))
# stabilise aggregated deliveries and expand them # stabilise aggregated deliveries and expand them
self.stepCallSlaposManageBuildingCalculatingDeliveryAlarm() self.stepCallSlaposManageBuildingCalculatingDeliveryAlarm()
...@@ -1136,8 +1137,11 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans ...@@ -1136,8 +1137,11 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
self.portal.portal_secure_payments.slapos_wechat_test.setWechatMode(original_mode) self.portal.portal_secure_payments.slapos_wechat_test.setWechatMode(original_mode)
def getAggregatedSalePackingList(self, subscription_request, specialise): def getAggregatedSalePackingList(self, subscription_request, specialise):
person_uid = subscription_request.getDestinationSectionValue().getUid() person = subscription_request.getDestinationSectionValue()
specialise_uid = self.portal.restrictedTraverse(specialise).getUid() person_uid = person.getUid()
trade_condition = person.Person_getAggregatedSubscriptionSaleTradeConditionValue(specialise)
specialise_uid = self.portal.restrictedTraverse(trade_condition).getUid()
return self.portal.portal_catalog( return self.portal.portal_catalog(
portal_type='Sale Packing List', portal_type='Sale Packing List',
...@@ -1325,15 +1329,16 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans ...@@ -1325,15 +1329,16 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
# check if Packing list is generated with the right trade condition # check if Packing list is generated with the right trade condition
preference_tool = self.portal.portal_preferences preference_tool = self.portal.portal_preferences
specialise_subscription_uid = preference_tool.getPreferredAggregatedSubscriptionSaleTradeCondition() aggregate_subscription_condition = \
specialise_uid = preference_tool.getPreferredAggregatedSaleTradeCondition() preference_tool.getPreferredAggregatedSubscriptionSaleTradeCondition()
trade_condition = preference_tool.getPreferredAggregatedSaleTradeCondition()
for subscription_request in subscription_request_list: for subscription_request in subscription_request_list:
hosting_subscription = subscription_request.getAggregateValue() hosting_subscription = subscription_request.getAggregateValue()
self.assertEqual(hosting_subscription.getCausalityState(), "solved") self.assertEqual(hosting_subscription.getCausalityState(), "solved")
sale_packing_list_list = self.getAggregatedSalePackingList( sale_packing_list_list = self.getAggregatedSalePackingList(
subscription_request, specialise_subscription_uid) subscription_request, aggregate_subscription_condition)
self.assertEqual(1, len(sale_packing_list_list)) self.assertEqual(1, len(sale_packing_list_list))
self.checkAggregatedSalePackingList(subscription_request, sale_packing_list_list[0]) self.checkAggregatedSalePackingList(subscription_request, sale_packing_list_list[0])
...@@ -1345,7 +1350,7 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans ...@@ -1345,7 +1350,7 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
len(self.getSubscriptionSalePackingList(subscription_request))) len(self.getSubscriptionSalePackingList(subscription_request)))
self.assertEqual(0, len(self.getAggregatedSalePackingList( self.assertEqual(0, len(self.getAggregatedSalePackingList(
subscription_request, specialise_uid))) subscription_request, trade_condition)))
# Call this alarm shouldn't affect the delivery # Call this alarm shouldn't affect the delivery
self.stepCallSlaposStartConfirmedAggregatedSalePackingListAlarm( self.stepCallSlaposStartConfirmedAggregatedSalePackingListAlarm(
...@@ -1354,7 +1359,7 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans ...@@ -1354,7 +1359,7 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
for subscription_request in subscription_request_list: for subscription_request in subscription_request_list:
self.assertEqual(1, len(self.getAggregatedSalePackingList( self.assertEqual(1, len(self.getAggregatedSalePackingList(
subscription_request, specialise_subscription_uid))) subscription_request, aggregate_subscription_condition)))
# Call this alarm shouldn't affect the delivery # Call this alarm shouldn't affect the delivery
self.stepCallSlaposStartConfirmedAggregatedSubscriptionSalePackingListAlarm() self.stepCallSlaposStartConfirmedAggregatedSubscriptionSalePackingListAlarm()
...@@ -1362,7 +1367,7 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans ...@@ -1362,7 +1367,7 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
for subscription_request in subscription_request_list: for subscription_request in subscription_request_list:
self.assertEqual(0, len(self.getAggregatedSalePackingList( self.assertEqual(0, len(self.getAggregatedSalePackingList(
subscription_request, specialise_uid))) subscription_request, trade_condition)))
# stabilise aggregated deliveries and expand them # stabilise aggregated deliveries and expand them
self.stepCallSlaposManageBuildingCalculatingDeliveryAlarm() self.stepCallSlaposManageBuildingCalculatingDeliveryAlarm()
......
...@@ -15,3 +15,4 @@ test.erp5.testSlapOSSubscriptionDualOrganisationScenario ...@@ -15,3 +15,4 @@ test.erp5.testSlapOSSubscriptionDualOrganisationScenario
test.erp5.testSlapOSSubscriptionCancellationScenario test.erp5.testSlapOSSubscriptionCancellationScenario
test.erp5.testSlapOSSubscriptionCDNScenario test.erp5.testSlapOSSubscriptionCDNScenario
test.erp5.testSlapOSSubscriptionCDNChineseScenario test.erp5.testSlapOSSubscriptionCDNChineseScenario
test.erp5.testSlapOSSubscriptionPerUserTradeConditionScenario
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment