Commit 9f1f76f1 authored by Antoine Catton's avatar Antoine Catton

Merge branch 'master' into rename_instance

Conflicts:
	master/bt5/vifib_base/bt/revision
	master/bt5/vifib_erp5/bt/revision
	master/bt5/vifib_slap/bt/revision
parents 92ad87f0 e7c1aa25
...@@ -51,9 +51,11 @@ ...@@ -51,9 +51,11 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>portal_type = context.getDeliveryPortalType()\n <value> <string>portal_type = context.getDeliveryPortalType()\n
# make sure that the result of the simulation state is update to date, so check getSimulationState manually\n simulation_state = \'planned\'\n
return [x.getObject() for x in context.portal_catalog(portal_type=portal_type,simulation_state=\'planned\') \n # use catalog to prefetch, but check later in ZODB\n
if x.getObject().getSimulationState()==\'planned\']\n return [x.getObject() for x in context.getPortalObject().portal_catalog(\n
portal_type=portal_type,\n
simulation_state=simulation_state) if x.getSimulationState() == simulation_state]\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
the new Invoice.\n the new Invoice.\n
"""\n """\n
from Products.ERP5Type.Message import translateString\n from Products.ERP5Type.Message import translateString\n
\n from DateTime import DateTime\n
if related_simulation_movement_path_list is None:\n if related_simulation_movement_path_list is None:\n
raise RuntimeError, \'related_simulation_movement_path_list is missing. Update ERP5 Product.\'\n raise RuntimeError, \'related_simulation_movement_path_list is missing. Update ERP5 Product.\'\n
\n \n
...@@ -65,6 +65,9 @@ if not invoice.Invoice_isAdvanced():\n ...@@ -65,6 +65,9 @@ if not invoice.Invoice_isAdvanced():\n
if not invoice.getResource():\n if not invoice.getResource():\n
invoice.setResource(invoice.getPriceCurrency())\n invoice.setResource(invoice.getPriceCurrency())\n
\n \n
if invoice.getStartDate() is None:\n
invoice.setStartDate(DateTime())\n
\n
# initialize accounting_workflow to planned state\n # initialize accounting_workflow to planned state\n
plan_tag = \'%s_plan\' % invoice.getPath()\n plan_tag = \'%s_plan\' % invoice.getPath()\n
if invoice.getSimulationState() == \'draft\':\n if invoice.getSimulationState() == \'draft\':\n
......
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>from Products.ERP5Type.Message import translateString\n <value> <string>from Products.ERP5Type.Message import translateString\n
from DateTime import DateTime\n
\n \n
payment_transaction = context\n payment_transaction = context\n
\n \n
...@@ -58,12 +59,29 @@ payment_transaction = context\n ...@@ -58,12 +59,29 @@ payment_transaction = context\n
if payment_transaction.getSimulationState() == "draft":\n if payment_transaction.getSimulationState() == "draft":\n
payment_transaction.plan(comment=translateString("Initialised by Delivery Builder."))\n payment_transaction.plan(comment=translateString("Initialised by Delivery Builder."))\n
\n \n
if payment_transaction.getStartDate() is None:\n
payment_transaction.setStartDate(DateTime())\n
\n
# First set the payment transaction in the building state on the causality workflow\n # First set the payment transaction in the building state on the causality workflow\n
payment_transaction.startBuilding()\n payment_transaction.startBuilding()\n
\n \n
# Then an activity should put the causality state in diverged or solved\n # Then an activity should put the causality state in diverged or solved\n
payment_transaction.activate(after_path_and_method_id=(related_simulation_movement_path_list,\n payment_transaction.activate(after_path_and_method_id=(related_simulation_movement_path_list,\n
(\'immediateReindexObject\',\'recursiveImmediateReindexObject\'))).updateCausalityState()\n (\'immediateReindexObject\',\'recursiveImmediateReindexObject\'))).updateCausalityState()\n
\n
# update casuality from movements\n
causality_list = payment_transaction.getCausalityList()\n
causality_list.sort()\n
modified = 0\n
for movement in payment_transaction.getMovementList():\n
movement_causality = movement.getCausality()\n
if movement_causality not in causality_list:\n
modified = 1\n
causality_list.append(movement_causality)\n
\n
if modified:\n
causality_list.sort()\n
payment_transaction.setCausalityList(causality_list)\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
348 351
\ No newline at end of file \ No newline at end of file
...@@ -127,9 +127,7 @@ ...@@ -127,9 +127,7 @@
</item> </item>
<item> <item>
<key> <string>preferred_payzen_integration_site</string> </key> <key> <string>preferred_payzen_integration_site</string> </key>
<value> <value> <string>portal_integrations/vifib_payzen_integration</string> </value>
<none/>
</value>
</item> </item>
<item> <item>
<key> <string>preferred_software_setup_resource</string> </key> <key> <string>preferred_software_setup_resource</string> </key>
......
89 90
\ No newline at end of file \ No newline at end of file
...@@ -114,9 +114,7 @@ ...@@ -114,9 +114,7 @@
<key> <string>completed_state</string> </key> <key> <string>completed_state</string> </key>
<value> <value>
<tuple> <tuple>
<string>confirmed</string>
<string>delivered</string> <string>delivered</string>
<string>started</string>
<string>stopped</string> <string>stopped</string>
</tuple> </tuple>
</value> </value>
......
...@@ -115,9 +115,7 @@ ...@@ -115,9 +115,7 @@
<item> <item>
<key> <string>completed_state</string> </key> <key> <string>completed_state</string> </key>
<value> <value>
<tuple> <tuple/>
<string>confirmed</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -149,6 +147,14 @@ ...@@ -149,6 +147,14 @@
<none/> <none/>
</value> </value>
</item> </item>
<item>
<key> <string>frozen_state</string> </key>
<value>
<tuple>
<string>delivered</string>
</tuple>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>pay</string> </value> <value> <string>pay</string> </value>
......
...@@ -37,13 +37,10 @@ ...@@ -37,13 +37,10 @@
<key> <string>tested_property</string> </key> <key> <string>tested_property</string> </key>
<value> <value>
<tuple> <tuple>
<string>source_payment</string>
<string>destination_payment</string>
<string>source_section</string> <string>source_section</string>
<string>destination_section</string> <string>destination_section</string>
<string>payment_mode</string> <string>payment_mode</string>
<string>resource</string> <string>resource</string>
<string>specialise</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
</item> </item>
<item> <item>
<key> <string>int_index</string> </key> <key> <string>int_index</string> </key>
<value> <int>2</int> </value> <value> <int>1</int> </value>
</item> </item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
...@@ -41,6 +41,9 @@ ...@@ -41,6 +41,9 @@
<string>destination</string> <string>destination</string>
<string>source_project</string> <string>source_project</string>
<string>destination_project</string> <string>destination_project</string>
<string>source_payment</string>
<string>destination_payment*</string>
<string>specialise</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -48,6 +51,10 @@ ...@@ -48,6 +51,10 @@
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>category_movement_group_on_line</string> </value> <value> <string>category_movement_group_on_line</string> </value>
</item> </item>
<item>
<key> <string>update_always</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<key> <string>categories</string> </key> <key> <string>categories</string> </key>
<value> <value>
<tuple> <tuple>
<string>collect_order_group/delivery</string> <string>collect_order_group/line</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>delivery_causality_assignement_movement_group_on_delivery</string> </value> <value> <string>delivery_causality_assignement_movement_group_on_line</string> </value>
</item> </item>
<item> <item>
<key> <string>int_index</string> </key> <key> <string>int_index</string> </key>
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>Delivery Causality Assignement Movement Group On Delivery</string> </value> <value> <string>delivery_causality_assignement_movement_group_on_line</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<value> <value>
<tuple> <tuple>
<string>divergence_scope/property</string> <string>divergence_scope/property</string>
<string>collect_order_group/delivery</string> <string>collect_order_group/line</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>property_movement_group_on_delivery</string> </value> <value> <string>property_movement_group_on_line</string> </value>
</item> </item>
<item> <item>
<key> <string>int_index</string> </key> <key> <string>int_index</string> </key>
...@@ -44,7 +44,11 @@ ...@@ -44,7 +44,11 @@
</item> </item>
<item> <item>
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>property_movement_group_on_delivery</string> </value> <value> <string>property_movement_group_on_line</string> </value>
</item>
<item>
<key> <string>update_always</string> </key>
<value> <int>0</int> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
</item> </item>
<item> <item>
<key> <string>delivery_select_method_id</string> </key> <key> <string>delivery_select_method_id</string> </key>
<value> <string>VifibInvoiceBuilder_selectPlannedSaleInvoiceList</string> </value> <value> <string>VifibDeliveryBuilder_selectPlannedDeliveryList</string> </value>
</item> </item>
<item> <item>
<key> <string>description</string> </key> <key> <string>description</string> </key>
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
</item> </item>
<item> <item>
<key> <string>int_index</string> </key> <key> <string>int_index</string> </key>
<value> <int>2</int> </value> <value> <int>1</int> </value>
</item> </item>
<item> <item>
<key> <string>portal_type</string> </key> <key> <string>portal_type</string> </key>
...@@ -37,8 +37,6 @@ ...@@ -37,8 +37,6 @@
<key> <string>tested_property</string> </key> <key> <string>tested_property</string> </key>
<value> <value>
<tuple> <tuple>
<string>delivery_mode</string>
<string>incoterm</string>
<string>source</string> <string>source</string>
<string>destination</string> <string>destination</string>
<string>source_section</string> <string>source_section</string>
...@@ -51,6 +49,10 @@ ...@@ -51,6 +49,10 @@
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>category_movement_group_on_delivery</string> </value> <value> <string>category_movement_group_on_delivery</string> </value>
</item> </item>
<item>
<key> <string>update_always</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
......
...@@ -55,6 +55,8 @@ ...@@ -55,6 +55,8 @@
<string>destination_project</string> <string>destination_project</string>
<string>source_payment</string> <string>source_payment</string>
<string>destination_payment</string> <string>destination_payment</string>
<string>delivery_mode</string>
<string>incoterm</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -62,6 +64,10 @@ ...@@ -62,6 +64,10 @@
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>category_movement_group_on_line</string> </value> <value> <string>category_movement_group_on_line</string> </value>
</item> </item>
<item>
<key> <string>update_always</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
<key> <string>tested_property</string> </key> <key> <string>tested_property</string> </key>
<value> <value>
<tuple> <tuple>
<string>specialise</string>
<string>resource</string> <string>resource</string>
<string>source</string> <string>source</string>
<string>destination</string> <string>destination</string>
...@@ -52,6 +53,10 @@ ...@@ -52,6 +53,10 @@
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string>category_movement_group_on_line</string> </value> <value> <string>category_movement_group_on_line</string> </value>
</item> </item>
<item>
<key> <string>update_always</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
......
72 82
\ No newline at end of file \ No newline at end of file
<local_roles_item>
<local_roles>
<role id='R-MEMBER'>
<item>Auditor</item>
<item>Author</item>
</role>
<role id='superluke'>
<item>Owner</item>
</role>
</local_roles>
</local_roles_item>
\ No newline at end of file
vifib_data_simulation vifib_data_simulation
vifib_data_payzen
\ No newline at end of file
328 329
\ No newline at end of file \ No newline at end of file
...@@ -47,6 +47,7 @@ person_module/test_vifib_user_developer ...@@ -47,6 +47,7 @@ person_module/test_vifib_user_developer
portal_contributions portal_contributions
portal_gadgets portal_gadgets
portal_integrations portal_integrations
portal_integrations/vifib_payzen_integration
product_module product_module
purchase_order_module purchase_order_module
purchase_packing_list_module purchase_packing_list_module
......
...@@ -12,8 +12,8 @@ account_module/refundable_vat ...@@ -12,8 +12,8 @@ account_module/refundable_vat
account_module/sales account_module/sales
accounting_module accounting_module
business_process_module business_process_module
business_process_module/vifib_sale_business_process
business_process_module/vifib_purchase_business_process business_process_module/vifib_purchase_business_process
business_process_module/vifib_sale_business_process
campaign_module campaign_module
component_module component_module
computer_module computer_module
...@@ -47,6 +47,7 @@ person_module/test_vifib_user_developer ...@@ -47,6 +47,7 @@ person_module/test_vifib_user_developer
portal_contributions portal_contributions
portal_gadgets portal_gadgets
portal_integrations portal_integrations
portal_integrations/vifib_payzen_integration
product_module product_module
purchase_order_module purchase_order_module
purchase_packing_list_module purchase_packing_list_module
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Alarm" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>active_sense_method_id</string> </key>
<value> <string>Alarm_registerPlannedPaymentTransactionPayzen</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>register_planned_payment_transaction_payzen</string> </value>
</item>
<item>
<key> <string>periodicity_hour</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_minute</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_minute_frequency</string> </key>
<value> <int>5</int> </value>
</item>
<item>
<key> <string>periodicity_month</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_month_day</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_start_date</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1288051200.0</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>periodicity_week</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Alarm</string> </value>
</item>
<item>
<key> <string>sense_method_id</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Register planned Payment Transaction in payzen</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -50,21 +50,24 @@ ...@@ -50,21 +50,24 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>portal_catalog = context.getPortalObject().portal_catalog\n <value> <string>portal = context.getPortalObject()\n
simulation_state = \'planned\'\n for payment_transaction in portal.portal_catalog(\n
# use catalog to prefetch, but check later in ZODB\n portal_type="Payment Transaction", \n
return [q.getObject() for q in portal_catalog(\n simulation_state="planned",\n
portal_type=\'Sale Invoice Transaction\',\n limit=10\n
simulation_state=simulation_state) if q.getSimulationState() == simulation_state]\n ):\n
# do not trust catalog\n
if payment_transaction.getSimulationState() == \'planned\':\n
payment_transaction.PaymentTransaction_registerPayzen()\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>**kw</string> </value> <value> <string></string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>VifibInvoiceBuilder_selectPlannedSaleInvoiceList</string> </value> <value> <string>Alarm_registerPlannedPaymentTransactionPayzen</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
48 49
\ No newline at end of file \ No newline at end of file
portal_alarms/payzen_update_confirmed_payment_transaction portal_alarms/payzen_update_confirmed_payment_transaction
portal_alarms/register_planned_payment_transaction_payzen
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Alarm" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>active_sense_method_id</string> </key>
<value> <string>Alarm_stopPlannedSaleInvoiceTransaction</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>stop_planned_sale_invoice_transaction</string> </value>
</item>
<item>
<key> <string>periodicity_hour</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_minute</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_minute_frequency</string> </key>
<value> <int>5</int> </value>
</item>
<item>
<key> <string>periodicity_month</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_month_day</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_start_date</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>3660.0</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>periodicity_week</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Alarm</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Stop planned Sale Invoices before current month</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
from DateTime import DateTime\n
from Products.ERP5Type.DateUtils import getClosestDate\n
\n
portal = context.getPortalObject()\n
this_month = getClosestDate(target_date=DateTime())\n
for sale_invoice_transaction in portal.portal_catalog(\n
portal_type=\'Sale Invoice Transaction\',\n
simulation_state=\'planned\',\n
limit=10,\n
**{"delivery.start_date": \'< %s\' % this_month}\n
):\n
if sale_invoice_transaction.getSimulationState() == \'planned\' and sale_invoice_transaction.getStartDate() < this_month:\n
# do not trust catalog\n
sale_invoice_transaction.confirm()\n
sale_invoice_transaction.start()\n
sale_invoice_transaction.stop()\n
]]></string> </value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Alarm_stopPlannedSaleInvoiceTransaction</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
501 502
\ No newline at end of file \ No newline at end of file
portal_alarms/confirm_ordered_sale_order portal_alarms/confirm_ordered_sale_order
portal_alarms/confirm_ordered_sale_order/** portal_alarms/confirm_ordered_sale_order/**
portal_alarms/stop_planned_sale_invoice_transaction
portal_alarms/stop_planned_sale_invoice_transaction/**
portal_alarms/vifib_trigger_build portal_alarms/vifib_trigger_build
portal_alarms/vifib_trigger_build/** portal_alarms/vifib_trigger_build/**
\ No newline at end of file
...@@ -10,9 +10,6 @@ class TestVifibInstanceHostingRelatedDocument(TestVifibSlapWebServiceMixin): ...@@ -10,9 +10,6 @@ class TestVifibInstanceHostingRelatedDocument(TestVifibSlapWebServiceMixin):
def stepTriggerBuild(self, sequence, **kw): def stepTriggerBuild(self, sequence, **kw):
self.portal.portal_alarms.vifib_trigger_build.activeSense() self.portal.portal_alarms.vifib_trigger_build.activeSense()
def stepCheckPayment(self, sequence, **kw):
raise NotImplementedError
def stepCheckSubscriptionSalePackingListCoverage(self, sequence, **kw): def stepCheckSubscriptionSalePackingListCoverage(self, sequence, **kw):
hosting_subscription = self.portal.portal_catalog.getResultValue( hosting_subscription = self.portal.portal_catalog.getResultValue(
uid=sequence['hosting_subscription_uid']) uid=sequence['hosting_subscription_uid'])
...@@ -145,12 +142,17 @@ class TestVifibInstanceHostingRelatedDocument(TestVifibSlapWebServiceMixin): ...@@ -145,12 +142,17 @@ class TestVifibInstanceHostingRelatedDocument(TestVifibSlapWebServiceMixin):
self.assertEqual(0, len(subscription_invoice_line_list)) self.assertEqual(0, len(subscription_invoice_line_list))
# invoice shall be solved # invoice shall be solved
self.assertEqual('solved', setup_invoice_line_list[0].getCausalityState()) invoice = setup_invoice_line_list[0].getParentValue()
self.assertEqual('solved', invoice.getCausalityState())
# invoice shall have causality of one packing list # invoice shall have causality of one packing list
self.assertEqual( self.assertEqual(
[setup_delivery_line_list[0].getParentValue().getUid()], [setup_delivery_line_list[0].getParentValue().getUid()],
setup_invoice_line_list[0].getParentValue().getCausalityUidList()) invoice.getCausalityUidList())
# there shall be no payment transaction related
self.assertEqual([], invoice.getCausalityRelatedList(
portal_type='Payment Transaction'))
sequence.edit( sequence.edit(
subscription_delivery_uid_list=[q.getParentValue().getUid() for q in \ subscription_delivery_uid_list=[q.getParentValue().getUid() for q in \
...@@ -244,6 +246,352 @@ class TestVifibInstanceHostingRelatedDocument(TestVifibSlapWebServiceMixin): ...@@ -244,6 +246,352 @@ class TestVifibInstanceHostingRelatedDocument(TestVifibSlapWebServiceMixin):
[q.getParentValue().getUid() for q in subscription_delivery_line_list if q.getSimulationState() == 'stopped']), [q.getParentValue().getUid() for q in subscription_delivery_line_list if q.getSimulationState() == 'stopped']),
sorted(setup_invoice_line_list[0].getParentValue().getCausalityUidList())) sorted(setup_invoice_line_list[0].getParentValue().getCausalityUidList()))
def stepSelectPlannedInvoice(self, sequence, **kw):
hosting_subscription = self.portal.portal_catalog.getResultValue(
uid=sequence['hosting_subscription_uid'])
invoice_line = self.portal.portal_catalog.getResultValue(
portal_type='Invoice Line',
aggregate_relative_url=hosting_subscription.getRelativeUrl(),
simulation_state='planned'
)
# there shall be no payment transaction related
self.assertEqual([], invoice_line.getParentValue().getCausalityRelatedList(
portal_type='Payment Transaction'))
sequence.edit(invoice_uid=invoice_line.getParentValue().getUid())
def stepConfirmInvoice(self, sequence, **kw):
self.portal.portal_catalog.getResultValue(
uid=sequence['invoice_uid']).confirm()
def stepCheckHostingSubscriptionConfirmedInvoiceDocumentCoverage(self,
sequence, **kw):
catalog = self.portal.portal_catalog
hosting_subscription = catalog.getResultValue(
uid=sequence['hosting_subscription_uid'])
hosting_subscription_url = hosting_subscription.getRelativeUrl()
# hosting is confirmed, so no invoice
hosting_delivery_line_list = catalog(portal_type='Sale Packing List Line',
aggregate_relative_url=hosting_subscription_url,
resource_relative_url=sequence['hosting_resource'])
self.assertEqual(1, len(hosting_delivery_line_list))
self.assertEqual('confirmed', hosting_delivery_line_list[0]\
.getSimulationState())
hosting_invoice_line_list = catalog(portal_type='Invoice Line',
aggregate_relative_url=hosting_subscription_url,
resource_relative_url=sequence['hosting_resource'])
self.assertEqual(0, len(hosting_invoice_line_list))
# setup is stopped, and has there is invoice
setup_delivery_line_list = catalog(portal_type='Sale Packing List Line',
aggregate_relative_url=hosting_subscription_url,
resource_relative_url=sequence['setup_resource'])
self.assertEqual(1, len(setup_delivery_line_list))
self.assertEqual('stopped', setup_delivery_line_list[0]\
.getSimulationState())
setup_invoice_line_list = catalog(portal_type='Invoice Line',
aggregate_relative_url=hosting_subscription_url,
resource_relative_url=sequence['setup_resource'])
self.assertEqual(1, len(setup_invoice_line_list))
self.assertEqual('confirmed', setup_invoice_line_list[0]\
.getSimulationState())
# there are 10 confirmed and 2 stopped subscription, so 2 invoice line
subscription_delivery_line_list = catalog(
portal_type='Sale Packing List Line',
aggregate_relative_url=hosting_subscription_url,
resource_relative_url=sequence['subscription_resource'])
self.assertEqual(12, len(subscription_delivery_line_list))
self.assertEqual((['confirmed'] * 10) + (['stopped'] * 2),
sorted([q.getSimulationState() for \
q in subscription_delivery_line_list]))
subscription_invoice_line_list = catalog(portal_type='Invoice Line',
aggregate_relative_url=hosting_subscription_url,
resource_relative_url=sequence['subscription_resource'])
self.assertEqual(2, len(subscription_invoice_line_list))
self.assertEqual(['confirmed', 'planned'],
sorted([q.getSimulationState() for q in subscription_invoice_line_list]))
# there are three invoice lines, where two share same invoice
# and other is on new one
self.assertEqual(
setup_invoice_line_list[0].getParentValue().getRelativeUrl(),
[q.getParentValue().getRelativeUrl() for q in \
subscription_invoice_line_list \
if q.getSimulationState() == 'confirmed'][0]
)
self.assertNotEqual(
setup_invoice_line_list[0].getParentValue().getRelativeUrl(),
[q.getParentValue().getRelativeUrl() for q in \
subscription_invoice_line_list \
if q.getSimulationState() == 'planned'][0]
)
confirmed_invoice = setup_invoice_line_list[0].getParentValue()
planned_invoice = [q.getParentValue() for q in \
subscription_invoice_line_list \
if q.getSimulationState() == 'planned'][0]
# invoices shall be solved
self.assertEqual('solved', planned_invoice.getCausalityState())
self.assertEqual('solved', confirmed_invoice.getCausalityState())
# there shall be no payment transaction related
self.assertEqual([], planned_invoice.getCausalityRelatedList(
portal_type='Payment Transaction'))
self.assertEqual([], confirmed_invoice.getCausalityRelatedList(
portal_type='Payment Transaction'))
# confirmed invoice shall have causality of two packing lists
self.assertEqual(
sorted([setup_delivery_line_list[0].getParentValue().getUid()] +
[q.getParentValue().getUid() for q in subscription_delivery_line_list \
if q.getSimulationState() == 'stopped' and \
q.getParentValue().getUid() != sequence['subscription_delivery_uid']]),
sorted(confirmed_invoice.getCausalityUidList()))
# planned invoice shall have causality of one packing list
self.assertEqual(
[q.getParentValue().getUid() for q in subscription_delivery_line_list \
if q.getSimulationState() == 'stopped' and \
q.getParentValue().getUid() == sequence['subscription_delivery_uid']],
planned_invoice.getCausalityUidList())
def stepStartInvoice(self, sequence, **kw):
self.portal.portal_catalog.getResultValue(
uid=sequence['invoice_uid']).start()
def stepStopInvoice(self, sequence, **kw):
self.portal.portal_catalog.getResultValue(
uid=sequence['invoice_uid']).stop()
def stepCheckHostingSubscriptionStoppedInvoiceDocumentCoverage(self,
sequence, **kw):
catalog = self.portal.portal_catalog
hosting_subscription = catalog.getResultValue(
uid=sequence['hosting_subscription_uid'])
hosting_subscription_url = hosting_subscription.getRelativeUrl()
# hosting is confirmed, so no invoice
hosting_delivery_line_list = catalog(portal_type='Sale Packing List Line',
aggregate_relative_url=hosting_subscription_url,
resource_relative_url=sequence['hosting_resource'])
self.assertEqual(1, len(hosting_delivery_line_list))
self.assertEqual('confirmed', hosting_delivery_line_list[0]\
.getSimulationState())
hosting_invoice_line_list = catalog(portal_type='Invoice Line',
aggregate_relative_url=hosting_subscription_url,
resource_relative_url=sequence['hosting_resource'])
self.assertEqual(0, len(hosting_invoice_line_list))
# setup is stopped, and has there is invoice
setup_delivery_line_list = catalog(portal_type='Sale Packing List Line',
aggregate_relative_url=hosting_subscription_url,
resource_relative_url=sequence['setup_resource'])
self.assertEqual(1, len(setup_delivery_line_list))
self.assertEqual('stopped', setup_delivery_line_list[0]\
.getSimulationState())
setup_invoice_line_list = catalog(portal_type='Invoice Line',
aggregate_relative_url=hosting_subscription_url,
resource_relative_url=sequence['setup_resource'])
self.assertEqual(1, len(setup_invoice_line_list))
self.assertEqual('stopped', setup_invoice_line_list[0]\
.getSimulationState())
# there are 10 confirmed and 2 stopped subscription, so 2 invoice line
subscription_delivery_line_list = catalog(
portal_type='Sale Packing List Line',
aggregate_relative_url=hosting_subscription_url,
resource_relative_url=sequence['subscription_resource'])
self.assertEqual(12, len(subscription_delivery_line_list))
self.assertEqual((['confirmed'] * 10) + (['stopped'] * 2),
sorted([q.getSimulationState() for \
q in subscription_delivery_line_list]))
subscription_invoice_line_list = catalog(portal_type='Invoice Line',
aggregate_relative_url=hosting_subscription_url,
resource_relative_url=sequence['subscription_resource'])
self.assertEqual(2, len(subscription_invoice_line_list))
self.assertEqual(['planned', 'stopped'],
sorted([q.getSimulationState() for q in subscription_invoice_line_list]))
# there are three invoice lines, where two share same invoice
# and other is on new one
self.assertEqual(
setup_invoice_line_list[0].getParentValue().getRelativeUrl(),
[q.getParentValue().getRelativeUrl() for q in \
subscription_invoice_line_list \
if q.getSimulationState() == 'stopped'][0]
)
self.assertNotEqual(
setup_invoice_line_list[0].getParentValue().getRelativeUrl(),
[q.getParentValue().getRelativeUrl() for q in \
subscription_invoice_line_list \
if q.getSimulationState() == 'planned'][0]
)
stopped_invoice = setup_invoice_line_list[0].getParentValue()
planned_invoice = [q.getParentValue() for q in \
subscription_invoice_line_list \
if q.getSimulationState() == 'planned'][0]
# invoices shall be solved
self.assertEqual('solved', planned_invoice.getCausalityState())
self.assertEqual('solved', stopped_invoice.getCausalityState())
# there shall be no payment transaction related to planned invoice
self.assertEqual([], planned_invoice.getCausalityRelatedList(
portal_type='Payment Transaction'))
# there shall be one payment transaction related to stopped invoice
payment_transaction_list = stopped_invoice.getCausalityRelatedValueList(
portal_type='Payment Transaction')
self.assertEqual(1, len(payment_transaction_list))
payment_transaction = payment_transaction_list[0]
# this payment transaction shall be planned and solved
self.assertEqual('planned', payment_transaction.getSimulationState())
self.assertEqual('solved', payment_transaction.getCausalityState())
# only this invoice shall be covered by this payment transaction
self.assertEqual(stopped_invoice.getRelativeUrl(),
payment_transaction.getCausality())
# this payment shall fully pay the invoice
self.assertEqual(stopped_invoice.getTotalPrice(),
payment_transaction.PaymentTransaction_getTotalPayablePrice())
# Stopped invoice shall have causality of two packing lists
self.assertEqual(
sorted([setup_delivery_line_list[0].getParentValue().getUid()] +
[q.getParentValue().getUid() for q in subscription_delivery_line_list \
if q.getSimulationState() == 'stopped' and \
q.getParentValue().getUid() != sequence['subscription_delivery_uid']]),
sorted(stopped_invoice.getCausalityUidList()))
# planned invoice shall have causality of one packing list
self.assertEqual(
[q.getParentValue().getUid() for q in subscription_delivery_line_list \
if q.getSimulationState() == 'stopped' and \
q.getParentValue().getUid() == sequence['subscription_delivery_uid']],
planned_invoice.getCausalityUidList())
def stepCheckHostingSubscriptionTwoStoppedInvoiceDocumentCoverage(self,
sequence, **kw):
catalog = self.portal.portal_catalog
hosting_subscription = catalog.getResultValue(
uid=sequence['hosting_subscription_uid'])
hosting_subscription_url = hosting_subscription.getRelativeUrl()
# hosting is confirmed, so no invoice
hosting_delivery_line_list = catalog(portal_type='Sale Packing List Line',
aggregate_relative_url=hosting_subscription_url,
resource_relative_url=sequence['hosting_resource'])
self.assertEqual(1, len(hosting_delivery_line_list))
self.assertEqual('confirmed', hosting_delivery_line_list[0]\
.getSimulationState())
hosting_invoice_line_list = catalog(portal_type='Invoice Line',
aggregate_relative_url=hosting_subscription_url,
resource_relative_url=sequence['hosting_resource'])
self.assertEqual(0, len(hosting_invoice_line_list))
# setup is stopped, and has there is invoice
setup_delivery_line_list = catalog(portal_type='Sale Packing List Line',
aggregate_relative_url=hosting_subscription_url,
resource_relative_url=sequence['setup_resource'])
self.assertEqual(1, len(setup_delivery_line_list))
self.assertEqual('stopped', setup_delivery_line_list[0]\
.getSimulationState())
setup_invoice_line_list = catalog(portal_type='Invoice Line',
aggregate_relative_url=hosting_subscription_url,
resource_relative_url=sequence['setup_resource'])
self.assertEqual(1, len(setup_invoice_line_list))
self.assertEqual('stopped', setup_invoice_line_list[0]\
.getSimulationState())
# there are 10 confirmed and 2 stopped subscription, so 2 invoice line
subscription_delivery_line_list = catalog(
portal_type='Sale Packing List Line',
aggregate_relative_url=hosting_subscription_url,
resource_relative_url=sequence['subscription_resource'])
self.assertEqual(12, len(subscription_delivery_line_list))
self.assertEqual((['confirmed'] * 10) + (['stopped'] * 2),
sorted([q.getSimulationState() for \
q in subscription_delivery_line_list]))
subscription_invoice_line_list = catalog(portal_type='Invoice Line',
aggregate_relative_url=hosting_subscription_url,
resource_relative_url=sequence['subscription_resource'])
self.assertEqual(2, len(subscription_invoice_line_list))
self.assertEqual(['stopped', 'stopped'],
sorted([q.getSimulationState() for q in subscription_invoice_line_list]))
# there are three invoice lines, where two share same invoice
# and other is on other one
first_invoice = setup_invoice_line_list[0].getParentValue()
second_invoice = [q.getParentValue() for q in subscription_invoice_line_list \
if q.getParentValue().getUid() != first_invoice.getUid()][0]
# invoices shall be solved
self.assertEqual('solved', first_invoice.getCausalityState())
self.assertEqual('solved', second_invoice.getCausalityState())
# both invoice shall have shared payment transaction
payment_transaction_list = first_invoice.getCausalityRelatedValueList(
portal_type='Payment Transaction')
self.assertEqual(1, len(payment_transaction_list))
payment_transaction = payment_transaction_list[0]
self.assertEqual([payment_transaction.getRelativeUrl()],
second_invoice.getCausalityRelatedList(
portal_type='Payment Transaction'))
# this payment transaction shall be planned and solved
self.assertEqual('planned', payment_transaction.getSimulationState())
self.assertEqual('solved', payment_transaction.getCausalityState())
# this payment shall fully pay both invoices
self.assertEqual(
first_invoice.getTotalPrice() + second_invoice.getTotalPrice(),
payment_transaction.PaymentTransaction_getTotalPayablePrice())
sequence.edit(payment_transaction_uid=payment_transaction.getUid())
def stepConfirmPayment(self, sequence, **kw):
self.portal.portal_catalog.getResultValue(
uid=sequence['payment_transaction_uid']).confirm()
def stepCheckPayment(self, sequence, **kw):
payment_transaction = self.portal.portal_catalog.getResultValue(
uid=sequence['payment_transaction_uid'])
self.assertEqual('confirmed', payment_transaction.getSimulationState())
self.assertEqual('solved', payment_transaction.getCausalityState())
def stepInvoiceSetStartDatePreviousMonth(self, sequence, **kw):
invoice = self.portal.portal_catalog.getResultValue(
uid=sequence['invoice_uid'])
invoice.setStartDate(getClosestDate(target_date=DateTime())-1)
def stepTriggerStopInvoiceAlarm(self, sequence, **kw):
self.portal.portal_alarms.stop_planned_sale_invoice_transaction.activeSense()
def test_OpenOrder_sale_packing_list(self): def test_OpenOrder_sale_packing_list(self):
""" """
...@@ -263,7 +611,7 @@ class TestVifibInstanceHostingRelatedDocument(TestVifibSlapWebServiceMixin): ...@@ -263,7 +611,7 @@ class TestVifibInstanceHostingRelatedDocument(TestVifibSlapWebServiceMixin):
# Nothing shall change # Nothing shall change
CheckHostingSubscriptionInitialDocumentCoverage CheckHostingSubscriptionInitialDocumentCoverage
# Stop first Subscriptoin delivery and after triggering build check # Stop first Subscription delivery and after triggering build check
# that invoice got updated # that invoice got updated
SelectNextSubscriptionDelivery SelectNextSubscriptionDelivery
...@@ -276,6 +624,54 @@ class TestVifibInstanceHostingRelatedDocument(TestVifibSlapWebServiceMixin): ...@@ -276,6 +624,54 @@ class TestVifibInstanceHostingRelatedDocument(TestVifibSlapWebServiceMixin):
CheckHostingSubscriptionStoppedDocumentCoverage CheckHostingSubscriptionStoppedDocumentCoverage
# proff that alarm will ignore this month invoices
TriggerStopInvoiceAlarm
Tic
CheckHostingSubscriptionStoppedDocumentCoverage
# Confirm current invoice and stop next delivery. After triggering build
# new planned invoice shall be available.
SelectPlannedInvoice
ConfirmInvoice
Tic
SelectNextSubscriptionDelivery
StartSubscriptionDelivery
StopSubscriptionDelivery
Tic
TriggerBuild
Tic
CheckHostingSubscriptionConfirmedInvoiceDocumentCoverage
# Lets check the payment
StartInvoice
StopInvoice
Tic
TriggerBuild
Tic
CheckHostingSubscriptionStoppedInvoiceDocumentCoverage
# Proof that alarm is capable to stop previous month invoice
SelectPlannedInvoice
InvoiceSetStartDatePreviousMonth
Tic
TriggerStopInvoiceAlarm
Tic
# Payment should cover both invoices
TriggerBuild
Tic
CheckHostingSubscriptionTwoStoppedInvoiceDocumentCoverage
ConfirmPayment
Tic
CheckPayment CheckPayment
""" """
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
......
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