Commit 2d85bcac authored by Romain Courteaud's avatar Romain Courteaud

slapos_*: add new trade condition versions

The new versions do not include any price informations.
It is needed to create new Trade Condition which inherite from those versions.

Update preference to use those latest trade conditions.
parent 8f453911
......@@ -135,7 +135,7 @@
</tuple>
<state>
<tuple>
<float>2524608000.0</float>
<float>1647302400.0</float>
<string>UTC</string>
</tuple>
</state>
......@@ -158,7 +158,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>SlapOS Aggregated Subscription Trade Condition (after 2021)</string> </value>
<value> <string>SlapOS Aggregated Subscription Trade Condition (before 2022)</string> </value>
</item>
<item>
<key> <string>version</string> </key>
......@@ -294,7 +294,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>998.58068.48763.8738</string> </value>
<value> <string>998.58069.32325.41352</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -312,7 +312,7 @@
</tuple>
<state>
<tuple>
<float>1647338249.48</float>
<float>1647348428.84</float>
<string>UTC</string>
</tuple>
</state>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Sale Trade Condition" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</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>categories</string> </key>
<value>
<tuple>
<string>specialise/business_process_module/slapos_aggregated_business_process</string>
</tuple>
</value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>slapos_aggregated_subscription_trade_condition</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>effective_date</string> </key>
<value>
<object>
<klass>
<global id="1.1" name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1647302400.0</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>expiration_date</string> </key>
<value>
<object>
<klass> <reference id="1.1"/> </klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>2524608000.0</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>slapos_aggregated_subscription_trade_condition_v3</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Sale Trade Condition</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>SlapOS Aggregated Subscription Trade Condition (after 2022)</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>003</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAc=</string> </persistent>
</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="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>start_date</string> </key>
<value>
<tuple>
<none/>
<none/>
</tuple>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<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>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAg=</string> </persistent>
</value>
</item>
<item>
<key> <string>validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAk=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="8" aka="AAAAAAAAAAg=">
<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>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAo=</string> </persistent>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>998.58239.48843.33996</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1647348480.83</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="9" aka="AAAAAAAAAAk=">
<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>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1647348490.89</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="10" aka="AAAAAAAAAAo=">
<pickle>
<global name="Message" module="Products.ERP5Type.Message"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string>Deleted objects: ${object_ids}</string> </value>
</item>
<item>
<key> <string>domain</string> </key>
<value> <string>ui</string> </value>
</item>
<item>
<key> <string>mapping</string> </key>
<value>
<dictionary>
<item>
<key> <string>object_ids</string> </key>
<value>
<list>
<string>reservation_price_eur</string>
<string>reservation_price_cny</string>
</list>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>message</string> </key>
<value> <string>Deleted objects: ${object_ids}</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Trade Model Line" 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>categories</string> </key>
<value>
<tuple>
<string>resource/service_module/slapos_tax</string>
<string>base_application/base_amount/invoicing/taxable</string>
<string>trade_phase/slapos/tax</string>
</tuple>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>VAT</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>reservation_tax_cny</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>language</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>membership_criterion_base_category</string> </key>
<value>
<tuple>
<string>price_currency</string>
</tuple>
</value>
</item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple>
<string>price_currency/currency_module/CNY</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Trade Model Line</string> </value>
</item>
<item>
<key> <string>price</string> </key>
<value> <float>0.01</float> </value>
</item>
<item>
<key> <string>quantity</string> </key>
<value> <float>1.0</float> </value>
</item>
<item>
<key> <string>string_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>target_delivery</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>VAT (CNY)</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</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/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<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>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1647348359.78</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="6" aka="AAAAAAAAAAY=">
<pickle>
<global name="Message" module="Products.ERP5Type.Message"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string>Object copied from ${source_item}</string> </value>
</item>
<item>
<key> <string>domain</string> </key>
<value> <string>erp5_ui</string> </value>
</item>
<item>
<key> <string>mapping</string> </key>
<value>
<dictionary>
<item>
<key> <string>source_item</string> </key>
<value> <string>/erp5/sale_trade_condition_module/slapos_aggregated_subscription_trade_condition</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>message</string> </key>
<value> <string>Object copied from ${source_item}</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Trade Model Line" 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>categories</string> </key>
<value>
<tuple>
<string>resource/service_module/slapos_tax</string>
<string>base_application/base_amount/invoicing/taxable</string>
<string>trade_phase/slapos/tax</string>
</tuple>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>VAT</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>reservation_tax_eur</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>language</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>membership_criterion_base_category</string> </key>
<value>
<tuple>
<string>price_currency</string>
</tuple>
</value>
</item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple>
<string>price_currency/currency_module/EUR</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Trade Model Line</string> </value>
</item>
<item>
<key> <string>price</string> </key>
<value> <float>0.2</float> </value>
</item>
<item>
<key> <string>quantity</string> </key>
<value> <float>1.0</float> </value>
</item>
<item>
<key> <string>string_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>target_delivery</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>VAT (EURO)</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</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/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<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>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1647348359.79</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="6" aka="AAAAAAAAAAY=">
<pickle>
<global name="Message" module="Products.ERP5Type.Message"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string>Object copied from ${source_item}</string> </value>
</item>
<item>
<key> <string>domain</string> </key>
<value> <string>erp5_ui</string> </value>
</item>
<item>
<key> <string>mapping</string> </key>
<value>
<dictionary>
<item>
<key> <string>source_item</string> </key>
<value> <string>/erp5/sale_trade_condition_module/slapos_aggregated_subscription_trade_condition</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>message</string> </key>
<value> <string>Object copied from ${source_item}</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -135,7 +135,7 @@
</tuple>
<state>
<tuple>
<float>2524608000.0</float>
<float>1647302400.0</float>
<string>UTC</string>
</tuple>
</state>
......@@ -152,7 +152,7 @@
</item>
<item>
<key> <string>title</string> </key>
<value> <string>SlapOS Aggregated Trade Condition (after 2018)</string> </value>
<value> <string>SlapOS Aggregated Trade Condition (before 2022)</string> </value>
</item>
<item>
<key> <string>version</string> </key>
......@@ -288,7 +288,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>998.58067.20441.49783</string> </value>
<value> <string>998.58067.43445.61166</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -306,7 +306,7 @@
</tuple>
<state>
<tuple>
<float>1647338139.67</float>
<float>1647349016.53</float>
<string>UTC</string>
</tuple>
</state>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Sale Trade Condition" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Access_contents_information_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Add_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_Modify_portal_content_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_View_Permission</string> </key>
<value>
<tuple>
<string>Assignee</string>
<string>Assignor</string>
<string>Associate</string>
<string>Auditor</string>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_identity_criterion</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</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>categories</string> </key>
<value>
<tuple>
<string>specialise/business_process_module/slapos_aggregated_business_process</string>
</tuple>
</value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>slapos_aggregated_trade_condition</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>effective_date</string> </key>
<value>
<object>
<klass>
<global id="1.1" name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1647302400.0</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>expiration_date</string> </key>
<value>
<object>
<klass> <reference id="1.1"/> </klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>2524608000.0</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>slapos_aggregated_trade_condition_v3</string> </value>
</item>
<item>
<key> <string>language</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Sale Trade Condition</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>SlapOS Aggregated Trade Condition (after 2022)</string> </value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>003</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAc=</string> </persistent>
</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="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>start_date</string> </key>
<value>
<tuple>
<none/>
<none/>
</tuple>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<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>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAg=</string> </persistent>
</value>
</item>
<item>
<key> <string>validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAk=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="8" aka="AAAAAAAAAAg=">
<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>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>998.58249.36169.41489</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1647349596.22</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="9" aka="AAAAAAAAAAk=">
<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>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1647349045.12</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Trade Model Line" 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>categories</string> </key>
<value>
<tuple>
<string>resource/service_module/slapos_tax</string>
<string>base_application/base_amount/invoicing/taxable</string>
<string>trade_phase/slapos/tax</string>
</tuple>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>VAT</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>reservation_tax_cny</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>language</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>membership_criterion_base_category</string> </key>
<value>
<tuple>
<string>price_currency</string>
<string>resource</string>
</tuple>
</value>
</item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple>
<string>price_currency/currency_module/CNY</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Trade Model Line</string> </value>
</item>
<item>
<key> <string>price</string> </key>
<value> <float>0.01</float> </value>
</item>
<item>
<key> <string>quantity</string> </key>
<value> <float>1.0</float> </value>
</item>
<item>
<key> <string>string_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>target_delivery</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>VAT (CNY)</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</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/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<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>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1647349013.24</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="6" aka="AAAAAAAAAAY=">
<pickle>
<global name="Message" module="Products.ERP5Type.Message"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string>Object copied from ${source_item}</string> </value>
</item>
<item>
<key> <string>domain</string> </key>
<value> <string>erp5_ui</string> </value>
</item>
<item>
<key> <string>mapping</string> </key>
<value>
<dictionary>
<item>
<key> <string>source_item</string> </key>
<value> <string>/erp5/sale_trade_condition_module/slapos_aggregated_trade_condition</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>message</string> </key>
<value> <string>Object copied from ${source_item}</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Trade Model Line" 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>categories</string> </key>
<value>
<tuple>
<string>resource/service_module/slapos_tax</string>
<string>base_application/base_amount/invoicing/taxable</string>
<string>trade_phase/slapos/tax</string>
</tuple>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>VAT</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>reservation_tax_eur</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>language</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>membership_criterion_base_category</string> </key>
<value>
<tuple>
<string>price_currency</string>
</tuple>
</value>
</item>
<item>
<key> <string>membership_criterion_category</string> </key>
<value>
<tuple>
<string>price_currency/currency_module/EUR</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Trade Model Line</string> </value>
</item>
<item>
<key> <string>price</string> </key>
<value> <float>0.2</float> </value>
</item>
<item>
<key> <string>quantity</string> </key>
<value> <float>1.0</float> </value>
</item>
<item>
<key> <string>string_index</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>target_delivery</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>test_method_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>VAT (EURO)</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</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/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>edit_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="5" aka="AAAAAAAAAAU=">
<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>edit</string> </value>
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent>
</value>
</item>
<item>
<key> <string>error_message</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>0.0.0.0</string> </value>
</item>
<item>
<key> <string>state</string> </key>
<value> <string>current</string> </value>
</item>
<item>
<key> <string>time</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1647349013.24</float>
<string>UTC</string>
</tuple>
</state>
</object>
</value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="6" aka="AAAAAAAAAAY=">
<pickle>
<global name="Message" module="Products.ERP5Type.Message"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string>Object copied from ${source_item}</string> </value>
</item>
<item>
<key> <string>domain</string> </key>
<value> <string>erp5_ui</string> </value>
</item>
<item>
<key> <string>mapping</string> </key>
<value>
<dictionary>
<item>
<key> <string>source_item</string> </key>
<value> <string>/erp5/sale_trade_condition_module/slapos_aggregated_trade_condition</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>message</string> </key>
<value> <string>Object copied from ${source_item}</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -17,6 +17,8 @@ from DateTime import DateTime
from erp5.component.module.DateUtils import addToDate#, getClosestDate
from zExceptions import Unauthorized
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL = 'sale_trade_condition_module/slapos_aggregated_trade_condition_v3'
class Simulator:
def __init__(self, outfile, method, to_return=None):
self.outfile = outfile
......@@ -959,18 +961,18 @@ class TestSlapOSConfirmedDeliveryMixin:
def test_typical(self):
self._test('confirmed', 'solved',
'sale_trade_condition_module/slapos_aggregated_trade_condition', True)
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL, True)
def test_bad_specialise(self):
self._test('confirmed', 'solved', None, False)
def test_bad_simulation_state(self):
self._test('started', 'solved',
'sale_trade_condition_module/slapos_aggregated_trade_condition', False)
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL, False)
def test_bad_causality_state(self):
self._test('confirmed', 'calculating',
'sale_trade_condition_module/slapos_aggregated_trade_condition', False)
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL, False)
@withAbort
def _test_script(self, simulation_state, causality_state, specialise,
......@@ -998,7 +1000,7 @@ class TestSlapOSConfirmedDeliveryMixin:
def test_script_typical(self):
self._test_script('confirmed', 'solved',
'sale_trade_condition_module/slapos_aggregated_trade_condition',
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
self.destination_state)
def test_script_bad_specialise(self):
......@@ -1006,17 +1008,17 @@ class TestSlapOSConfirmedDeliveryMixin:
def test_script_bad_simulation_state(self):
self._test_script('started', 'solved',
'sale_trade_condition_module/slapos_aggregated_trade_condition',
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
'started')
def test_script_bad_causality_state(self):
self._test_script('confirmed', 'building',
'sale_trade_condition_module/slapos_aggregated_trade_condition',
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
'confirmed')
def test_script_bad_consistency(self):
self._test_script('confirmed', 'solved',
'sale_trade_condition_module/slapos_aggregated_trade_condition',
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
'confirmed', True)
class TestSlapOSStartConfirmedAggregatedSalePackingListAlarm(
......@@ -1028,19 +1030,19 @@ class TestSlapOSStartConfirmedAggregatedSalePackingListAlarm(
def test_previous_month(self):
self._test('confirmed', 'solved',
'sale_trade_condition_module/slapos_aggregated_trade_condition',
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
True, delivery_date=DateTime("2012/03/22"),
accounting_date=DateTime('2012/04/28'))
def test_next_month(self):
self._test('confirmed', 'solved',
'sale_trade_condition_module/slapos_aggregated_trade_condition',
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
False, delivery_date=DateTime("2012/05/22"),
accounting_date=DateTime('2012/04/28'))
def test_same_month_early(self):
self._test('confirmed', 'solved',
'sale_trade_condition_module/slapos_aggregated_trade_condition',
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
False, delivery_date=DateTime("2012/04/22"),
accounting_date=DateTime('2012/04/23'))
......@@ -1048,7 +1050,7 @@ class TestSlapOSStartConfirmedAggregatedSalePackingListAlarm(
delivery = self.portal.sale_packing_list_module.newContent(
portal_type="Sale Packing List",
start_date=DateTime("2012/04/22"),
specialise='sale_trade_condition_module/slapos_aggregated_trade_condition',
specialise=AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
source=self.expected_slapos_organisation,
source_section=self.expected_slapos_organisation,
destination=self.expected_slapos_organisation,
......@@ -1108,18 +1110,18 @@ class TestSlapOSDeliverStartedAggregatedSalePackingListAlarm(
def test_typical(self):
self._test('started', 'solved',
'sale_trade_condition_module/slapos_aggregated_trade_condition', True)
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL, True)
def test_bad_specialise(self):
self._test('started', 'solved', None, False)
def test_bad_simulation_state(self):
self._test('confirmed', 'solved',
'sale_trade_condition_module/slapos_aggregated_trade_condition', False)
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL, False)
def test_bad_causality_state(self):
self._test('started', 'calculating',
'sale_trade_condition_module/slapos_aggregated_trade_condition', False)
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL, False)
@withAbort
def _test_script(self, simulation_state, causality_state, specialise,
......@@ -1147,7 +1149,7 @@ class TestSlapOSDeliverStartedAggregatedSalePackingListAlarm(
def test_script_typical(self):
self._test_script('started', 'solved',
'sale_trade_condition_module/slapos_aggregated_trade_condition',
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
self.destination_state)
def test_script_bad_specialise(self):
......@@ -1155,17 +1157,17 @@ class TestSlapOSDeliverStartedAggregatedSalePackingListAlarm(
def test_script_bad_simulation_state(self):
self._test_script('confirmed', 'solved',
'sale_trade_condition_module/slapos_aggregated_trade_condition',
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
'confirmed')
def test_script_bad_causality_state(self):
self._test_script('started', 'building',
'sale_trade_condition_module/slapos_aggregated_trade_condition',
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
'started')
def test_script_bad_consistency(self):
self._test_script('started', 'solved',
'sale_trade_condition_module/slapos_aggregated_trade_condition',
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
'started', True)
class TestSlapOSStopConfirmedAggregatedSaleInvoiceTransactionAlarm(
......
......@@ -8,6 +8,8 @@
from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin
from DateTime import DateTime
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL = 'sale_trade_condition_module/slapos_aggregated_trade_condition_v3'
def convertCategoryList(base, l):
return ['%s/%s' % (base, q) for q in l]
......@@ -63,7 +65,7 @@ class TestSlapOSSalePackingListBuilder(SlapOSTestCaseMixin):
'source/%s' % self.expected_slapos_organisation,
'source_section/%s' % self.expected_slapos_organisation,
'price_currency/currency_module/EUR',
'specialise/sale_trade_condition_module/slapos_aggregated_trade_condition'] \
'specialise/%s' % AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL] \
+ convertCategoryList('destination',
simulation_movement.getDestinationList()) \
+ convertCategoryList('destination_section',
......@@ -99,7 +101,7 @@ class TestSlapOSSalePackingListBuilder(SlapOSTestCaseMixin):
resource='service_module/slapos_instance_subscription',
source=self.expected_slapos_organisation,
source_section=self.expected_slapos_organisation,
specialise='sale_trade_condition_module/slapos_aggregated_trade_condition',
specialise=AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
trade_phase='slapos/delivery',
use='trade/sale',
)
......@@ -159,7 +161,7 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
price_currency='currency_module/EUR',
source=self.expected_slapos_organisation,
source_section=self.expected_slapos_organisation,
specialise='sale_trade_condition_module/slapos_aggregated_trade_condition',
specialise=AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
)
delivery_line_kw = dict(
portal_type='Sale Packing List Line',
......@@ -244,7 +246,7 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
resource='service_module/slapos_instance_subscription',
source=self.expected_slapos_organisation,
source_section=self.expected_slapos_organisation,
specialise='sale_trade_condition_module/slapos_aggregated_trade_condition',
specialise=AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
trade_phase='slapos/delivery',
use='trade/sale',
delivery_ratio=1.0
......@@ -465,7 +467,7 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
price_currency='currency_module/EUR',
source=self.expected_slapos_organisation,
source_section=self.expected_slapos_organisation,
specialise='sale_trade_condition_module/slapos_aggregated_trade_condition'
specialise=AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL
)
delivery_line_kw = dict(
portal_type='Sale Packing List Line',
......@@ -550,7 +552,7 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
resource='service_module/slapos_instance_subscription',
source=self.expected_slapos_organisation,
source_section=self.expected_slapos_organisation,
specialise='sale_trade_condition_module/slapos_aggregated_trade_condition',
specialise=AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
trade_phase='slapos/delivery',
use='trade/sale',
delivery_ratio=1.0
......@@ -736,7 +738,7 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
price_currency='currency_module/EUR',
source=self.expected_slapos_organisation,
source_section=self.expected_slapos_organisation,
specialise='sale_trade_condition_module/slapos_aggregated_trade_condition',
specialise=AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
)
delivery_line_kw = dict(
portal_type='Sale Packing List Line',
......@@ -819,7 +821,7 @@ class TestSlapOSSaleInvoiceBuilder(TestSlapOSSalePackingListBuilder):
resource='service_module/slapos_instance_subscription',
source=self.expected_slapos_organisation,
source_section=self.expected_slapos_organisation,
specialise='sale_trade_condition_module/slapos_aggregated_trade_condition',
specialise=AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
trade_phase='slapos/delivery',
use='trade/sale',
delivery_ratio=1.0
......@@ -1043,7 +1045,7 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
source_section=self.expected_slapos_organisation,
price_currency='currency_module/EUR',
resource='currency_module/EUR',
specialise='sale_trade_condition_module/slapos_aggregated_trade_condition',
specialise=AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
created_by_builder=1
)
invoice_line_kw = dict(
......@@ -1122,7 +1124,7 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
resource='service_module/slapos_instance_subscription',
source=self.expected_slapos_organisation,
source_section=self.expected_slapos_organisation,
specialise='sale_trade_condition_module/slapos_aggregated_trade_condition',
specialise=AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
use='trade/sale',
)
invoice_rule_1 = simulation_movement_1.newContent(
......@@ -1142,7 +1144,7 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
delivery_ratio=1.,
delivery_error=0.,
price_currency='currency_module/EUR',
specialise='sale_trade_condition_module/slapos_aggregated_trade_condition',
specialise=AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
resource='service_module/slapos_tax',
base_application='base_amount/invoicing/taxable',
use='trade/tax',
......@@ -1212,7 +1214,7 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
resource='currency_module/EUR',
source='account_module/receivable',
source_section=self.expected_slapos_organisation,
specialise='sale_trade_condition_module/slapos_aggregated_trade_condition',
specialise=AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
trade_phase='slapos/accounting',
price=1.0,
quantity=invoice_movement_1.getTotalPrice() * -1,
......@@ -1232,7 +1234,7 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
resource='currency_module/EUR',
source='account_module/receivable',
source_section=self.expected_slapos_organisation,
specialise='sale_trade_condition_module/slapos_aggregated_trade_condition',
specialise=AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
trade_phase='slapos/accounting',
price=1.0,
quantity=invoice_movement_1.getTotalPrice(),
......@@ -1253,7 +1255,7 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
resource='currency_module/EUR',
source='account_module/receivable',
source_section=self.expected_slapos_organisation,
specialise='sale_trade_condition_module/slapos_aggregated_trade_condition',
specialise=AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
trade_phase='slapos/accounting',
price=1.0,
quantity=trade_movement_1.getTotalPrice() * -1,
......@@ -1272,7 +1274,7 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
resource='currency_module/EUR',
source='account_module/coll_vat',
source_section=self.expected_slapos_organisation,
specialise='sale_trade_condition_module/slapos_aggregated_trade_condition',
specialise=AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
trade_phase='slapos/accounting',
price=1.0,
quantity=trade_movement_1.getTotalPrice(),
......@@ -1294,7 +1296,7 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
resource='currency_module/EUR',
source='account_module/receivable',
source_section=self.expected_slapos_organisation,
specialise='sale_trade_condition_module/slapos_aggregated_trade_condition',
specialise=AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
trade_phase='slapos/accounting',
price=1.0,
quantity=invoice_movement_2.getTotalPrice() * -1,
......@@ -1311,7 +1313,7 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
resource='currency_module/EUR',
source='account_module/receivable',
source_section=self.expected_slapos_organisation,
specialise='sale_trade_condition_module/slapos_aggregated_trade_condition',
specialise=AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
trade_phase='slapos/accounting',
price=1.0,
quantity=invoice_movement_2.getTotalPrice(),
......@@ -1332,7 +1334,7 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
resource='currency_module/EUR',
source='account_module/receivable',
source_section=self.expected_slapos_organisation,
specialise='sale_trade_condition_module/slapos_aggregated_trade_condition',
specialise=AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
trade_phase='slapos/accounting',
price=1.0,
quantity=trade_movement_2.getTotalPrice() * -1,
......@@ -1348,7 +1350,7 @@ class TestSlapOSSaleInvoiceTransactionBuilder(TestSlapOSSalePackingListBuilder):
resource='currency_module/EUR',
source='account_module/coll_vat',
source_section=self.expected_slapos_organisation,
specialise='sale_trade_condition_module/slapos_aggregated_trade_condition',
specialise=AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
trade_phase='slapos/accounting',
price=1.0,
quantity=trade_movement_2.getTotalPrice(),
......@@ -1546,7 +1548,7 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis
source_section=self.expected_slapos_organisation,
price_currency='currency_module/EUR',
resource='currency_module/EUR',
specialise='sale_trade_condition_module/slapos_aggregated_trade_condition',
specialise=AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
created_by_builder=1
)
invoice_line_kw = dict(
......@@ -1609,7 +1611,7 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis
resource='service_module/slapos_instance_subscription',
source=self.expected_slapos_organisation,
source_section=self.expected_slapos_organisation,
specialise='sale_trade_condition_module/slapos_aggregated_trade_condition',
specialise=AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
use='trade/sale',
)
invoice_rule_1 = simulation_movement_1.newContent(
......@@ -1649,7 +1651,7 @@ class TestSlapOSSaleInvoiceTransactionTradeModelBuilder(TestSlapOSSalePackingLis
quantity_unit='unit/piece',
source=self.expected_slapos_organisation,
source_section=self.expected_slapos_organisation,
specialise='sale_trade_condition_module/slapos_aggregated_trade_condition',
specialise=AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
portal_type='Simulation Movement',
)
model_rule_1 = invoice_movement_1.newContent(
......@@ -1880,8 +1882,7 @@ class TestSlapOSAggregatedDeliveryBuilder(SlapOSTestCaseMixin):
'price_currency/currency_module/EUR',
'source/%s' % self.expected_slapos_organisation,
'source_section/%s' % self.expected_slapos_organisation,
'specialise/sale_trade_condition_module/'
'slapos_aggregated_trade_condition'],
'specialise/%s' % AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL],
built_delivery.getCategoryList())
self.assertEqual(DateTime().earliestTime(), built_delivery.getStartDate())
delivery_line_list = built_delivery.contentValues(
......
......@@ -11,6 +11,8 @@ from unittest import skip
import transaction
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL = 'sale_trade_condition_module/slapos_aggregated_trade_condition_v3'
class TestHostingSubscription(TestSlapOSConstraintMixin):
# use decrator in order to avoid fixing consistency of new object
......@@ -159,7 +161,7 @@ class TestSaleInvoiceTransaction(TestSlapOSConstraintMixin):
self.assertTrue(message in self.getMessageList(invoice))
invoice.setSpecialise('sale_trade_condition_module/slapos_aggregated_trade_condition')
invoice.setSpecialise(AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL)
self.assertFalse(message in self.getMessageList(invoice))
@withAbort
......@@ -184,7 +186,7 @@ class TestSaleInvoiceTransaction(TestSlapOSConstraintMixin):
invoice = self.portal.accounting_module.newContent(
portal_type='Sale Invoice Transaction',
price_currency='currency_module/EUR',
specialise='sale_trade_condition_module/slapos_aggregated_trade_condition')
specialise=AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL)
invoice.newContent(portal_type='Invoice Line', quantity=1., price=1.,
base_contribution='base_amount/invoicing/taxable')
......@@ -213,7 +215,7 @@ class TestSaleInvoiceTransaction(TestSlapOSConstraintMixin):
self.assertFalse(message in self.getMessageList(invoice))
self.portal.portal_workflow._jumpToStateFor(invoice, 'confirmed')
self.assertFalse(message in self.getMessageList(invoice))
invoice.setSpecialise('sale_trade_condition_module/slapos_aggregated_trade_condition')
invoice.setSpecialise(AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL)
self.assertTrue(message in self.getMessageList(invoice))
invoice_line.setQuantity(1.)
self.assertFalse(message in self.getMessageList(invoice))
......
......@@ -11,6 +11,8 @@ from erp5.component.module.DateUtils import addToDate
from erp5.component.document.SimulationMovement import SimulationMovement
import transaction
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL = 'sale_trade_condition_module/slapos_aggregated_trade_condition_v3'
def getSimulationStatePlanned(self, *args, **kwargs):
return 'planned'
......@@ -69,7 +71,7 @@ class TestDefaultInvoiceTransactionRule(SlapOSTestCaseMixin):
trade_phase='slapos/invoicing',
quantity_unit='unit/piece',
specialise=
'sale_trade_condition_module/slapos_aggregated_trade_condition',
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
causality_list=['business_process_module/slapos_aggregated_business_process/invoice_path', 'business_process_module/slapos_aggregated_business_process/invoice'],
delivery_value=self.portal.accounting_module.newContent(
portal_type='Sale Invoice Transaction').newContent(
......@@ -197,7 +199,7 @@ class TestDefaultInvoiceRule(SlapOSTestCaseMixin):
use='trade/sale',
trade_phase='slapos/invoicing',
quantity_unit='unit/piece',
specialise='sale_trade_condition_module/slapos_aggregated_trade_condition',
specialise=AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
causality_list=['business_process_module/slapos_aggregated_business_process/invoice_path',
'business_process_module/slapos_aggregated_business_process/invoice'])
......@@ -274,7 +276,7 @@ class TestDefaultInvoicingRule(SlapOSTestCaseMixin):
use='trade/sale',
trade_phase='slapos/delivery',
quantity_unit='unit/piece',
specialise='sale_trade_condition_module/slapos_aggregated_trade_condition',
specialise=AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
causality_list=['business_process_module/slapos_aggregated_business_process/delivery_path', 'business_process_module/slapos_aggregated_business_process/deliver'])
self.assertEqual('planned',
......@@ -388,7 +390,7 @@ class TestDefaultPaymentRule(SlapOSTestCaseMixin):
use='trade/sale',
trade_phase='slapos/accounting',
quantity_unit='unit/piece',
specialise='sale_trade_condition_module/slapos_aggregated_trade_condition',
specialise=AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
causality_list=['business_process_module/slapos_aggregated_business_process/account'],
delivery_value=self.portal.accounting_module.newContent(
portal_type='Sale Invoice Transaction').newContent(
......@@ -706,7 +708,7 @@ class TestDefaultTradeModelRule(SlapOSTestCaseMixin):
use='trade/sale',
trade_phase='slapos/invoicing',
quantity_unit='unit/piece',
specialise='sale_trade_condition_module/slapos_aggregated_trade_condition',
specialise=AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
causality_list=['business_process_module/slapos_aggregated_business_process/invoice_path', 'business_process_module/slapos_aggregated_business_process/invoice'],
delivery_value=self.portal.accounting_module.newContent(
portal_type='Sale Invoice Transaction').newContent(
......@@ -778,7 +780,7 @@ class TestDefaultTradeModelRule(SlapOSTestCaseMixin):
.original_getSimulationState
class TestDefaultDeliveryRule(SlapOSTestCaseMixin):
trade_condition = 'sale_trade_condition_module/slapos_aggregated_trade_condition'
trade_condition = AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL
def test(self):
def newArrow():
return self.portal.organisation_module.newContent(
......
currency_module/CNY
currency_module/EUR
sale_trade_condition_module/couscous_trade_condition
sale_trade_condition_module/slapos_aggregated_trade_condition_v3
sale_trade_condition_module/slapos_aggregated_trade_condition_v3/**
sale_trade_condition_module/slapos_aggregated_consumption_trade_condition
sale_trade_condition_module/slapos_aggregated_consumption_trade_condition/**
sale_trade_condition_module/slapos_aggregated_subscription_trade_condition
sale_trade_condition_module/slapos_aggregated_subscription_trade_condition/**
sale_trade_condition_module/slapos_aggregated_subscription_trade_condition_v3
sale_trade_condition_module/slapos_aggregated_subscription_trade_condition_v3/**
sale_trade_condition_module/slapos_aggregated_trade_condition
sale_trade_condition_module/slapos_aggregated_trade_condition/**
sale_trade_condition_module/slapos_legacy_aggregated_trade_condition
......
......@@ -78,8 +78,12 @@ sale_trade_condition_module/slapos_aggregated_consumption_trade_condition
sale_trade_condition_module/slapos_aggregated_consumption_trade_condition/**
sale_trade_condition_module/slapos_aggregated_subscription_trade_condition
sale_trade_condition_module/slapos_aggregated_subscription_trade_condition/**
sale_trade_condition_module/slapos_aggregated_subscription_trade_condition_v3
sale_trade_condition_module/slapos_aggregated_subscription_trade_condition_v3/**
sale_trade_condition_module/slapos_aggregated_trade_condition
sale_trade_condition_module/slapos_aggregated_trade_condition/**
sale_trade_condition_module/slapos_aggregated_trade_condition_v3
sale_trade_condition_module/slapos_aggregated_trade_condition_v3/**
sale_trade_condition_module/slapos_consumption_trade_condition
sale_trade_condition_module/slapos_legacy_aggregated_subscription_trade_condition
sale_trade_condition_module/slapos_legacy_aggregated_subscription_trade_condition/**
......
......@@ -87,11 +87,11 @@
</item>
<item>
<key> <string>preferred_aggregated_sale_trade_condition</string> </key>
<value> <string>sale_trade_condition_module/slapos_aggregated_trade_condition</string> </value>
<value> <string>sale_trade_condition_module/slapos_aggregated_trade_condition_v3</string> </value>
</item>
<item>
<key> <string>preferred_aggregated_subscription_sale_trade_condition</string> </key>
<value> <string>sale_trade_condition_module/slapos_aggregated_subscription_trade_condition</string> </value>
<value> <string>sale_trade_condition_module/slapos_aggregated_subscription_trade_condition_v3</string> </value>
</item>
<item>
<key> <string>preferred_authentication_failure_block_duration</string> </key>
......
......@@ -602,7 +602,7 @@ class SlapOSTestCaseMixin(testSlapOSMixin):
destination_reference=new_destination_reference,
destination_section=destination_section,
payment_mode=payment_mode,
specialise="sale_trade_condition_module/slapos_aggregated_trade_condition",
specialise="sale_trade_condition_module/slapos_aggregated_trade_condition_v3",
created_by_builder=1 # to prevent init script to create lines
)
self.portal.portal_workflow._jumpToStateFor(invoice, 'stopped')
......@@ -698,9 +698,9 @@ return %s""" % (script_name, fake_return ))
preferred_aggregated_consumption_sale_trade_condition=\
'sale_trade_condition_module/slapos_aggregated_consumption_trade_condition',
preferred_aggregated_sale_trade_condition=\
'sale_trade_condition_module/slapos_aggregated_trade_condition',
'sale_trade_condition_module/slapos_aggregated_trade_condition_v3',
preferred_aggregated_subscription_sale_trade_condition=\
'sale_trade_condition_module/slapos_aggregated_subscription_trade_condition',
'sale_trade_condition_module/slapos_aggregated_subscription_trade_condition_v3',
preferred_default_pre_payment_template=\
'accounting_module/slapos_pre_payment_template',
preferred_instance_delivery_template=\
......
<local_roles_item>
<local_roles>
<role id='G-COMPANY'>
<item>Assignor</item>
</role>
<role id='R-SHADOW-PERSON'>
<item>Auditor</item>
</role>
</local_roles>
<local_role_group_ids>
<local_role_group_id id='group'>
<principal id='G-COMPANY'>Assignor</principal>
</local_role_group_id>
<local_role_group_id id='shadow'>
<principal id='R-SHADOW-PERSON'>Auditor</principal>
</local_role_group_id>
</local_role_group_ids>
</local_roles_item>
\ No newline at end of file
<local_roles_item>
<local_roles>
<role id='G-COMPANY'>
<item>Assignor</item>
</role>
<role id='R-SHADOW-PERSON'>
<item>Auditor</item>
</role>
</local_roles>
<local_role_group_ids>
<local_role_group_id id='group'>
<principal id='G-COMPANY'>Assignor</principal>
</local_role_group_id>
<local_role_group_id id='shadow'>
<principal id='R-SHADOW-PERSON'>Auditor</principal>
</local_role_group_id>
</local_role_group_ids>
</local_roles_item>
\ No newline at end of file
......@@ -72,8 +72,9 @@ sale_trade_condition_module
sale_trade_condition_module/payzen_sale_trade_condition
sale_trade_condition_module/slapos_aggregated_consumption_trade_condition
sale_trade_condition_module/slapos_aggregated_subscription_trade_condition
sale_trade_condition_module/slapos_aggregated_subscription_trade_condition_v3
sale_trade_condition_module/slapos_aggregated_trade_condition
sale_trade_condition_module/slapos_aggregated_trade_condition
sale_trade_condition_module/slapos_aggregated_trade_condition_v3
sale_trade_condition_module/slapos_consumption_trade_condition
sale_trade_condition_module/slapos_manual_accounting_trade_condition
sale_trade_condition_module/slapos_reservation_refund_trade_condition
......
......@@ -24,6 +24,9 @@ from zExceptions import Unauthorized
from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
from DateTime import DateTime
AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL = 'sale_trade_condition_module/slapos_aggregated_trade_condition_v3'
MARKER = ()
class TestSubscriptionSkinsMixin(SlapOSTestCaseMixinWithAbort):
def createNotificationMessage(self, reference,
......@@ -42,31 +45,55 @@ class TestSubscriptionSkinsMixin(SlapOSTestCaseMixinWithAbort):
notification_message.validate()
return notification_message
def newSaleTradeCondition(self, **kw):
def newSaleTradeCondition(self, payment_mode='payzen',
price_currency='currency_module/EUR', **kw):
sale_trade_condition = self.portal.sale_trade_condition_module.newContent(
portal_type='Sale Trade Condition',
title="Test Sale Trade Condition %s" % self.new_id,
reference="TESTSALETRADECONDITION-%s" % self.new_id,
payment_mode=payment_mode,
price_currency=price_currency,
source_value=self.slapos_organisation,
source_section_value=self.slapos_organisation,
specialise=AGGREGATE_SALE_TRADE_CONDITION_RELATIVE_URL,
**kw
)
sale_trade_condition.newContent(
portal_type="Sale Supply Line",
base_price=321,
resource='service_module/slapos_instance_subscription',
)
sale_trade_condition.newContent(
portal_type="Sale Supply Line",
base_price=123,
resource='service_module/slapos_reservation_fee_2',
)
sale_trade_condition.validate()
self.tic()
return sale_trade_condition
def newSubscriptionCondition(self, **kw):
def newSubscriptionCondition(self, specialise_value=MARKER, **kw):
if specialise_value is MARKER:
specialise_value = self.newSaleTradeCondition()
subscription_condition = self.portal.subscription_condition_module.newContent(
portal_type='Subscription Condition',
title="Test Subscription Condition %s" % self.new_id,
reference="TESTSUBSCRIPTIONCONDITION-%s" % self.new_id,
specialise_value=specialise_value,
**kw
)
subscription_condition.validate()
self.tic()
return subscription_condition
def newSubscriptionRequest(self, **kw):
def newSubscriptionRequest(self, specialise_value=MARKER, **kw):
if specialise_value is MARKER:
specialise_value = self.newSubscriptionCondition()
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,
specialise_value=specialise_value,
**kw
)
self.tic()
......@@ -334,8 +361,8 @@ class TestSubscriptionRequest_applyCondition(TestSubscriptionSkinsMixin):
def test_SubscriptionRequest_applyCondition_raises_unauthorized(self):
self.assertRaises(Unauthorized, self.portal.SubscriptionRequest_applyCondition, REQUEST=self.portal.REQUEST)
def test_SubscriptionRequest_applyCondition_raises_if_no_subscription_request(self):
subscription_request = self.newSubscriptionRequest()
def test_SubscriptionRequest_applyCondition_raises_if_no_subscription_condition(self):
subscription_request = self.newSubscriptionRequest(specialise_value=None)
self.assertRaises(ValueError, subscription_request.SubscriptionRequest_applyCondition)
def test_SubscriptionRequest_applyCondition(self):
......@@ -358,8 +385,6 @@ class TestSubscriptionRequest_applyCondition(TestSubscriptionSkinsMixin):
price_currency="currency_module/EUR",
source_reference="test_for_test_123")
subscription_condition.validate()
subscription_request = self.newSubscriptionRequest(
quantity=1, destination_section_value=person,
specialise_value=subscription_condition)
......@@ -461,7 +486,7 @@ class TestSubscriptionRequest_requestPaymentTransaction(TestSubscriptionSkinsMix
quantity=1)
self.assertEqual(None,
subscription_request.SubscriptionRequest_requestPaymentTransaction("xx", "en"))
subscription_request.SubscriptionRequest_requestPaymentTransaction("xx"))
def _test_request_payment_transaction(self, quantity):
email = "abc%s@nexedi.com" % self.new_id
......@@ -475,7 +500,7 @@ class TestSubscriptionRequest_requestPaymentTransaction(TestSubscriptionSkinsMix
default_email_text="abc%s@nexedi.com" % self.new_id)
subscription_request.setQuantity(quantity)
current_payment = subscription_request.SubscriptionRequest_requestPaymentTransaction("TAG", "en")
current_payment = subscription_request.SubscriptionRequest_requestPaymentTransaction("TAG")
self.tic()
self.assertNotEqual(None, current_payment)
self.assertEqual(current_payment.getTitle(), "Payment for Reservation Fee")
......@@ -491,9 +516,9 @@ class TestSubscriptionRequest_requestPaymentTransaction(TestSubscriptionSkinsMix
for line in current_payment.contentValues():
if line.getSource() == "account_module/payment_to_encash":
self.assertEqual(line.getQuantity(), -30*quantity)
self.assertEqual(line.getQuantity(), -(123 * 1.2)*quantity)
if line.getSource() == "account_module/receivable":
self.assertEqual(line.getQuantity(), 30*quantity)
self.assertEqual(line.getQuantity(), (123 * 1.2)*quantity)
def _test_request_payment_transaction_chinese(self, quantity):
email = "abc%s@nexedi.com" % self.new_id
......@@ -504,9 +529,16 @@ class TestSubscriptionRequest_requestPaymentTransaction(TestSubscriptionSkinsMix
subscription_request = self.newSubscriptionRequest(
quantity=quantity, destination_section_value=person,
default_email_text="abc%s@nexedi.com" % self.new_id)
default_email_text="abc%s@nexedi.com" % self.new_id,
specialise_value=self.newSubscriptionCondition(
specialise_value=self.newSaleTradeCondition(
payment_mode='wechat',
price_currency='currency_module/CNY'
)
)
)
current_payment = subscription_request.SubscriptionRequest_requestPaymentTransaction("TAG", "zh")
current_payment = subscription_request.SubscriptionRequest_requestPaymentTransaction("TAG")
self.tic()
self.assertNotEqual(None, current_payment)
self.assertEqual(current_payment.getTitle(), "Payment for Reservation Fee")
......@@ -521,13 +553,13 @@ class TestSubscriptionRequest_requestPaymentTransaction(TestSubscriptionSkinsMix
for line in current_payment.contentValues():
if line.getSource() == "account_module/payment_to_encash":
self.assertEqual(line.getQuantity(), -189.88*quantity)
self.assertEqual(line.getQuantity(), -(123 * 1.01)*quantity)
if line.getSource() == "account_module/receivable":
self.assertEqual(line.getQuantity(), 189.88*quantity)
self.assertEqual(line.getQuantity(), (123 * 1.01)*quantity)
@simulate('SubscriptionRequest_createRelatedSaleInvoiceTransaction', 'price, tag, payment, template, REQUEST=None',"""assert REQUEST == None
assert payment
assert price == 25.0
assert price == 123
assert tag == 'TAG'
assert template == context.portal_preferences.getPreferredDefaultPrePaymentSubscriptionInvoiceTemplate()""")
def test_request_payment_transaction_q1(self):
......@@ -535,7 +567,7 @@ assert template == context.portal_preferences.getPreferredDefaultPrePaymentSubsc
@simulate('SubscriptionRequest_createRelatedSaleInvoiceTransaction', 'price, tag, payment, template, REQUEST=None',"""assert REQUEST == None
assert payment
assert price == 25.0
assert price == 123
assert tag == 'TAG'
assert template == context.portal_preferences.getPreferredDefaultPrePaymentSubscriptionInvoiceTemplate()""")
def test_request_payment_transaction_q2(self):
......@@ -543,7 +575,7 @@ assert template == context.portal_preferences.getPreferredDefaultPrePaymentSubsc
@simulate('SubscriptionRequest_createRelatedSaleInvoiceTransaction', 'price, tag, payment, template, REQUEST=None',"""assert REQUEST == None
assert payment
assert price == 25.0
assert price == 123
assert tag == 'TAG'
assert template == context.portal_preferences.getPreferredDefaultPrePaymentSubscriptionInvoiceTemplate()""")
def test_request_payment_transaction_q10(self):
......@@ -551,17 +583,17 @@ assert template == context.portal_preferences.getPreferredDefaultPrePaymentSubsc
@simulate('SubscriptionRequest_createRelatedSaleInvoiceTransaction', 'price, tag, payment, template, REQUEST=None',"""assert REQUEST == None
assert payment
assert price == 188
assert price == 123
assert tag == 'TAG'
assert template == context.portal_preferences.getPreferredZhPrePaymentSubscriptionInvoiceTemplate()""")
assert template == context.portal_preferences.getPreferredDefaultPrePaymentSubscriptionInvoiceTemplate()""")
def test_request_payment_transaction_chinese_q1(self):
self._test_request_payment_transaction_chinese(quantity=1)
@simulate('SubscriptionRequest_createRelatedSaleInvoiceTransaction', 'price, tag, payment, template, REQUEST=None',"""assert REQUEST == None
assert payment
assert price == 188
assert price == 123
assert tag == 'TAG'
assert template == context.portal_preferences.getPreferredZhPrePaymentSubscriptionInvoiceTemplate()""")
assert template == context.portal_preferences.getPreferredDefaultPrePaymentSubscriptionInvoiceTemplate()""")
def test_request_payment_transaction_chinese_q10(self):
self._test_request_payment_transaction_chinese(quantity=10)
......@@ -594,15 +626,18 @@ class TestSubscriptionRequest_createRelatedSaleInvoiceTransaction(TestSubscripti
name = "Cous Cous %s" % self.new_id
person, _ = self.portal.SubscriptionRequest_createUser(name=name, email=email)
self.tic()
subscription_condition = self.newSubscriptionCondition()
subscription_request = self.newSubscriptionRequest(
quantity=quantity, destination_section_value=person,
default_email_text="abc%s@nexedi.com" % self.new_id)
default_email_text="abc%s@nexedi.com" % self.new_id,
specialise_value=subscription_condition
)
# The SubscriptionRequest_createRelatedSaleInvoiceTransaction is invoked up, as it proven on
# test TestSubscriptionRequest_requestPaymentTransaction, so let's keep it simple, and just reinvoke
current_payment = subscription_request.SubscriptionRequest_requestPaymentTransaction("TAG", "en")
current_payment = subscription_request.SubscriptionRequest_requestPaymentTransaction("TAG")
self.tic()
......@@ -677,7 +712,6 @@ class SubscriptionRequest_processRequest(TestSubscriptionSkinsMixin):
</instance>""",
root_slave=False,
source_reference="test_for_test_123")
subscription_condition.validate()
subscription_request = self.newSubscriptionRequest(
quantity=1, destination_section_value=person,
specialise_value=subscription_condition
......@@ -1058,7 +1092,6 @@ class TestSubscriptionRequest_processOrdered(TestSubscriptionSkinsMixin):
person = self.makePerson()
subscription_condition = self.newSubscriptionCondition(
specialise='sale_trade_condition_module/slapos_subscription_trade_condition',
url_string="https://%s/software.cfg" % self.new_id,
sla_xml="""<?xml version="1.0" encoding="utf-8"?>
<instance>
......@@ -1072,7 +1105,6 @@ class TestSubscriptionRequest_processOrdered(TestSubscriptionSkinsMixin):
</instance>""",
root_slave=False,
source_reference="test_for_test_123")
subscription_condition.validate()
subscription_request = self.newSubscriptionRequest(
quantity=1, destination_section_value=person,
specialise_value=subscription_condition
......@@ -1154,7 +1186,6 @@ class TestSubscriptionRequest_processOrdered(TestSubscriptionSkinsMixin):
source_reference="test_for_test_123",
specialise_value=self.newSaleTradeCondition()
)
subscription_condition.validate()
subscription_request = self.newSubscriptionRequest(
quantity=1, destination_section_value=person,
specialise_value=subscription_condition
......@@ -1164,7 +1195,7 @@ class TestSubscriptionRequest_processOrdered(TestSubscriptionSkinsMixin):
# The SubscriptionRequest_createRelatedSaleInvoiceTransaction is invoked up, as it proven on
# test TestSubscriptionRequest_requestPaymentTransaction, so let's keep it simple, and just reinvoke
current_payment = subscription_request.SubscriptionRequest_requestPaymentTransaction("TAG", "en")
current_payment = subscription_request.SubscriptionRequest_requestPaymentTransaction("TAG")
self.assertNotEqual(current_payment, None)
......@@ -1238,7 +1269,6 @@ class TestSubscriptionRequest_processOrdered(TestSubscriptionSkinsMixin):
source_reference="test_for_test_123",
specialise_value=self.newSaleTradeCondition()
)
subscription_condition.validate()
subscription_request = self.newSubscriptionRequest(
quantity=1, destination_section_value=person,
specialise_value=subscription_condition
......
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