Commit a4a1f573 authored by Antoine Catton's avatar Antoine Catton

Merge branch 'master' into rename_instance

Conflicts:
	master/bt5/vifib_base/bt/revision
	master/bt5/vifib_slap/bt/revision
parents 489c93a5 f5852e98
...@@ -320,25 +320,15 @@ ...@@ -320,25 +320,15 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string>select_dict= {\'delivery_uid\': None}\n
kw[\'select_dict\']=select_dict\n
from Products.ERP5Type.DateUtils import getClosestDate\n kw[\'left_join_list\']=select_dict.keys()\n
from DateTime import DateTime\n kw[\'delivery_uid\']=None\n
\n
# support build_before\n
build_before = kw.pop(\'build_before\', None)\n
if build_before is None:\n
build_before = getClosestDate(target_date=DateTime(), precision=\'month\', before=0)\n
kw[\'movement.start_date\'] = \'< %s\' % build_before\n
\n
if src__==0:\n if src__==0:\n
return context.portal_catalog(**kw)\n return context.portal_catalog(**kw)\n
\n
else:\n else:\n
return context.portal_catalog(src__=1, **kw)\n return context.portal_catalog(src__=1, **kw)\n
</string> </value>
]]></string> </value>
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
......
...@@ -50,14 +50,12 @@ ...@@ -50,14 +50,12 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>portal = context.getPortalObject()\n <value> <string>portal_catalog = context.getPortalObject().portal_catalog\n
accounting_module = portal.getDefaultModule(\'Sale Invoice Transaction\')\n simulation_state = \'planned\'\n
\n # use catalog to prefetch, but check later in ZODB\n
invoice = accounting_module.searchFolder(\n return [q.getObject() for q in portal_catalog(\n
portal_type=\'Sale Invoice Transaction\',\n portal_type=\'Sale Invoice Transaction\',\n
simulation_state=\'planned\')\n simulation_state=simulation_state) if q.getSimulationState() == simulation_state]\n
\n
return invoice\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
...@@ -50,20 +50,10 @@ ...@@ -50,20 +50,10 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[ <value> <string>"""This script is called on the Invoice after the delivery builder has created\n
"""This script is called on the Invoice after the delivery builder has created\n
the new Invoice.\n the new Invoice.\n
"""\n """\n
from Products.ERP5Type.Message import translateString\n from Products.ERP5Type.Message import translateString\n
try:\n
from Products.CMFCore.WorkflowCore import WorkflowException\n
except ImportError:\n
# WorkflowException has not always been allowed in restricted\n
# environment, in this case, make sure WorkflowException is \n
# defined \n
class WorkflowException(Exception):\n
pass\n
\n \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
...@@ -75,60 +65,17 @@ if not invoice.Invoice_isAdvanced():\n ...@@ -75,60 +65,17 @@ 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
related_packing_list = invoice.getDefaultCausalityValue()\n # initialize accounting_workflow to planned state\n
related_order = related_packing_list.getDefaultCausalityValue()\n plan_tag = \'%s_plan\' % invoice.getPath()\n
\n
# copy payment conditions from packing list\n
# if missing, try to copy from order (for compatibility)\n
if not invoice.contentValues(portal_type=\'Payment Condition\'):\n
payment_condition_copy_id_list = []\n
if related_packing_list is not None:\n
payment_condition_copy_id_list = related_packing_list.contentIds(filter={\'portal_type\':\'Payment Condition\'})\n
if len(payment_condition_copy_id_list) > 0:\n
clipboard = related_packing_list.manage_copyObjects(ids=payment_condition_copy_id_list)\n
invoice.manage_pasteObjects(clipboard)\n
elif related_order is not None:\n
payment_condition_copy_id_list = related_order.contentIds(\n
filter={\'portal_type\':\'Payment Condition\'})\n
if len(payment_condition_copy_id_list) > 0:\n
clipboard = related_order.manage_copyObjects(ids=payment_condition_copy_id_list)\n
invoice.manage_pasteObjects(clipboard)\n
\n
if related_order is not None and context.portal_skins.hasObject(\'erp5_simulation_legacy\'):\n
# copy trade condition:\n
if not context.getSpecialise():\n
context.edit(specialise=related_order.getSpecialise())\n
\n
# copy order\'s trade model lines\n
invoice_trade_model_line_reference_list = [document.getReference() \\\n
for document in context.contentValues(portal_type=\'Trade Model Line\')]\n
order_trade_model_line_copy_id_list = []\n
for order_trade_model_line in related_order.contentValues(\n
portal_type=\'Trade Model Line\'):\n
if order_trade_model_line.getReference() not in \\\n
invoice_trade_model_line_reference_list:\n
order_trade_model_line_copy_id_list.append(order_trade_model_line.getId())\n
\n
if order_trade_model_line_copy_id_list:\n
clipboard = related_order.manage_copyObjects(\n
ids=order_trade_model_line_copy_id_list)\n
context.manage_pasteObjects(clipboard)\n
\n
# copy title, if not updating a new delivery\n
if not invoice.hasTitle() and related_packing_list.hasTitle():\n
invoice.setTitle(related_packing_list.getTitle())\n
\n
# initialize accounting_workflow to confirmed state\n
confirm_tag = \'%s_confirm\' % invoice.getPath()\n
if invoice.getSimulationState() == \'draft\':\n if invoice.getSimulationState() == \'draft\':\n
invoice.activate(after_path_and_method_id=(related_simulation_movement_path_list,\n invoice.activate(after_path_and_method_id=(related_simulation_movement_path_list,\n
(\'immediateReindexObject\',\'recursiveImmediateReindexObject\')),\n (\'immediateReindexObject\',\'recursiveImmediateReindexObject\')),\n
tag=confirm_tag).Delivery_confirm()\n tag=plan_tag).plan(comment=translateString(\'Initialised by Delivery Builder.\'))\n
else:\n else:\n
# call builder just same as after script of \'confirm\' transition\n # call builder just same as after script of \'plan\' transition\n
invoice.activate(after_path_and_method_id=(related_simulation_movement_path_list,\n invoice.activate(after_path_and_method_id=(related_simulation_movement_path_list,\n
(\'immediateReindexObject\',\'recursiveImmediateReindexObject\')),\n (\'immediateReindexObject\',\'recursiveImmediateReindexObject\')),\n
tag=confirm_tag).Delivery_expandAndBuild()\n tag=plan_tag).Delivery_expandAndBuild()\n
\n \n
# First set the invoice in the building state on the causality workflow\n # First set the invoice in the building state on the causality workflow\n
invoice.startBuilding()\n invoice.startBuilding()\n
...@@ -136,10 +83,22 @@ invoice.startBuilding()\n ...@@ -136,10 +83,22 @@ invoice.startBuilding()\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
invoice.activate(after_path_and_method_id=(related_simulation_movement_path_list,\n invoice.activate(after_path_and_method_id=(related_simulation_movement_path_list,\n
(\'immediateReindexObject\',\'recursiveImmediateReindexObject\')),\n (\'immediateReindexObject\',\'recursiveImmediateReindexObject\')),\n
after_tag=confirm_tag).updateCausalityState()\n after_tag=plan_tag).updateCausalityState()\n
\n
# update casuality from movements\n
]]></string> </value> causality_list = invoice.getCausalityList()\n
causality_list.sort()\n
modified = 0\n
for movement in invoice.getMovementList(portal_type=\'Invoice Line\'):\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
invoice.setCausalityList(causality_list)\n
</string> </value>
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
......
340 346
\ No newline at end of file \ No newline at end of file
...@@ -63,9 +63,7 @@ ...@@ -63,9 +63,7 @@
<item> <item>
<key> <string>aggregated_portal_type</string> </key> <key> <string>aggregated_portal_type</string> </key>
<value> <value>
<tuple> <tuple/>
<string>Usage Report</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
......
88 89
\ No newline at end of file \ No newline at end of file
...@@ -50,7 +50,6 @@ ...@@ -50,7 +50,6 @@
<value> <value>
<tuple> <tuple>
<string>trade_phase/vifib/accounting</string> <string>trade_phase/vifib/accounting</string>
<string>trade_date/trade_phase/vifib/invoicing</string>
<string>source/account_module/sales</string> <string>source/account_module/sales</string>
<string>destination/account_module/purchase</string> <string>destination/account_module/purchase</string>
</tuple> </tuple>
......
...@@ -50,7 +50,6 @@ ...@@ -50,7 +50,6 @@
<value> <value>
<tuple> <tuple>
<string>trade_phase/vifib/accounting</string> <string>trade_phase/vifib/accounting</string>
<string>trade_date/trade_phase/vifib/invoicing</string>
<string>source/account_module/receivable</string> <string>source/account_module/receivable</string>
<string>destination/account_module/payable</string> <string>destination/account_module/payable</string>
</tuple> </tuple>
......
...@@ -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>
......
...@@ -70,7 +70,6 @@ ...@@ -70,7 +70,6 @@
<value> <value>
<tuple> <tuple>
<string>trade_phase/vifib/delivery</string> <string>trade_phase/vifib/delivery</string>
<string>trade_date/trade_phase/vifib/order</string>
<string>end_of/day</string> <string>end_of/day</string>
</tuple> </tuple>
</value> </value>
......
...@@ -49,7 +49,6 @@ ...@@ -49,7 +49,6 @@
<key> <string>categories</string> </key> <key> <string>categories</string> </key>
<value> <value>
<tuple> <tuple>
<string>trade_date/trade_phase/vifib/delivery</string>
<string>trade_phase/vifib/invoicing</string> <string>trade_phase/vifib/invoicing</string>
</tuple> </tuple>
</value> </value>
......
...@@ -50,7 +50,6 @@ ...@@ -50,7 +50,6 @@
<value> <value>
<tuple> <tuple>
<string>trade_phase/vifib/order</string> <string>trade_phase/vifib/order</string>
<string>trade_date/trade_phase/vifib/order</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -52,7 +52,6 @@ ...@@ -52,7 +52,6 @@
<string>trade_phase/vifib/payment</string> <string>trade_phase/vifib/payment</string>
<string>source/account_module/receivable</string> <string>source/account_module/receivable</string>
<string>destination/account_module/payable</string> <string>destination/account_module/payable</string>
<string>trade_date/trade_phase/vifib/invoicing</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
...@@ -52,7 +52,6 @@ ...@@ -52,7 +52,6 @@
<string>trade_phase/vifib/payment</string> <string>trade_phase/vifib/payment</string>
<string>source/account_module/bank</string> <string>source/account_module/bank</string>
<string>destination/account_module/bank</string> <string>destination/account_module/bank</string>
<string>trade_date/trade_phase/vifib/invoicing</string>
<string>source_payment/organisation_module/vifib_internet/bank_account</string> <string>source_payment/organisation_module/vifib_internet/bank_account</string>
</tuple> </tuple>
</value> </value>
......
...@@ -37,21 +37,12 @@ ...@@ -37,21 +37,12 @@
<key> <string>tested_property</string> </key> <key> <string>tested_property</string> </key>
<value> <value>
<tuple> <tuple>
<string>specialise</string>
<string>delivery_mode</string> <string>delivery_mode</string>
<string>incoterm</string> <string>incoterm</string>
<string>source</string> <string>source</string>
<string>destination</string> <string>destination</string>
<string>source_section</string> <string>source_section</string>
<string>destination_section</string> <string>destination_section</string>
<string>source_decision</string>
<string>destination_decision</string>
<string>source_administration</string>
<string>destination_administration</string>
<string>source_project</string>
<string>destination_project</string>
<string>source_payment</string>
<string>destination_payment</string>
<string>price_currency</string> <string>price_currency</string>
</tuple> </tuple>
</value> </value>
......
...@@ -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>aggregate</string> <string>aggregate</string>
<string>quantity_unit</string> <string>quantity_unit</string>
...@@ -46,6 +47,14 @@ ...@@ -46,6 +47,14 @@
<string>destination_function</string> <string>destination_function</string>
<string>source_account</string> <string>source_account</string>
<string>destination_account</string> <string>destination_account</string>
<string>source_decision</string>
<string>destination_decision</string>
<string>source_administration</string>
<string>destination_administration</string>
<string>source_project</string>
<string>destination_project</string>
<string>source_payment</string>
<string>destination_payment</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Causality Movement Group" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>collect_order_group/delivery</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>causality_movement_group_on_delivery</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Causality Movement Group</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>causality_movement_group_on_delivery</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -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>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Property Movement Group" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>divergence_scope/property</string>
<string>collect_order_group/delivery</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>property_movement_group_on_delivery</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Property Movement Group</string> </value>
</item>
<item>
<key> <string>tested_property</string> </key>
<value>
<tuple>
<string>start_date</string>
<string>stop_date</string>
</tuple>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>property_movement_group_on_delivery</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -38,6 +38,8 @@ ...@@ -38,6 +38,8 @@
<value> <value>
<tuple> <tuple>
<string>description</string> <string>description</string>
<string>start_date</string>
<string>stop_date</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -47,6 +49,10 @@ ...@@ -47,6 +49,10 @@
<none/> <none/>
</value> </value>
</item> </item>
<item>
<key> <string>update_always</string> </key>
<value> <int>0</int> </value>
</item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Property Movement Group" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>divergence_scope/property</string>
<string>collect_order_group/delivery</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>property_movement_group_on_delivery</string> </value>
</item>
<item>
<key> <string>int_index</string> </key>
<value> <int>2</int> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Property Movement Group</string> </value>
</item>
<item>
<key> <string>tested_property</string> </key>
<value>
<tuple>
<string>start_date</string>
<string>stop_date</string>
</tuple>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>property_movement_group_on_delivery</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
64 72
\ No newline at end of file \ No newline at end of file
account_module/bank
account_module/capital
account_module/coll_vat
account_module/equipments
account_module/inventories
account_module/payable
account_module/profit_loss
account_module/purchase
account_module/receivable
account_module/refundable_vat
account_module/sales
portal_rules/new_invoice_simulation_rule
portal_rules/new_invoice_simulation_rule/**
portal_rules/new_delivery_simulation_rule
portal_rules/new_delivery_simulation_rule/**
portal_rules/new_delivery_root_simulation_rule
portal_rules/new_delivery_root_simulation_rule/**
portal_rules/new_invoice_transaction_simulation_rule
portal_rules/new_invoice_transaction_simulation_rule/**
portal_rules/new_invoice_root_simulation_rule
portal_rules/new_invoice_root_simulation_rule/**
portal_rules/new_order_root_simulation_rule
portal_rules/new_order_root_simulation_rule/**
portal_rules/default_subscription_item_rule
portal_rules/default_subscription_item_rule/**
portal_rules/new_payment_simulation_rule
portal_rules/new_payment_simulation_rule/**
\ No newline at end of file
############################################################################## ###############################################################################
# #
# Copyright (c) 2002-2011 Nexedi SA and Contributors. All Rights Reserved. # Copyright (c) 2002-2011 Nexedi SA and Contributors. All Rights Reserved.
# #
...@@ -86,7 +86,6 @@ def SoftwareInstance_requestDestroySlaveInstanceRelated(self): ...@@ -86,7 +86,6 @@ def SoftwareInstance_requestDestroySlaveInstanceRelated(self):
computer_partition_relative_url = self.getAggregateRelatedValue( computer_partition_relative_url = self.getAggregateRelatedValue(
"Sale Packing List Line").getAggregate(portal_type="Computer Partition") "Sale Packing List Line").getAggregate(portal_type="Computer Partition")
portal_preferences = portal.portal_preferences portal_preferences = portal.portal_preferences
simulation_state = ["started", "confirmed"]
service_uid_list = [ service_uid_list = [
portal.restrictedTraverse(portal_preferences.getPreferredInstanceHostingResource()).getUid(), portal.restrictedTraverse(portal_preferences.getPreferredInstanceHostingResource()).getUid(),
portal.restrictedTraverse(portal_preferences.getPreferredInstanceSetupResource()).getUid(), portal.restrictedTraverse(portal_preferences.getPreferredInstanceSetupResource()).getUid(),
...@@ -95,10 +94,13 @@ def SoftwareInstance_requestDestroySlaveInstanceRelated(self): ...@@ -95,10 +94,13 @@ def SoftwareInstance_requestDestroySlaveInstanceRelated(self):
result_list = self.portal_catalog(portal_type="Sale Packing List Line", result_list = self.portal_catalog(portal_type="Sale Packing List Line",
aggregate_portal_type="Slave Instance", aggregate_portal_type="Slave Instance",
computer_partition_relative_url=computer_partition_relative_url, computer_partition_relative_url=computer_partition_relative_url,
simulation_state=simulation_state,
default_resource_uid=service_uid_list) default_resource_uid=service_uid_list)
slave_instance_list = [line.getAggregateValue(portal_type="Slave Instance") for line in result_list] slave_instance_list = [line.getAggregateValue(portal_type="Slave Instance") for line in result_list]
uid_list = []
for slave_instance in slave_instance_list: for slave_instance in slave_instance_list:
slave_instance_uid = slave_instance.getUid()
if slave_instance_uid in uid_list:
continue
cleanup_packing_list = self.portal_catalog( cleanup_packing_list = self.portal_catalog(
portal_type='Sale Packing List Line', portal_type='Sale Packing List Line',
aggregate_relative_url=slave_instance.getRelativeUrl(), aggregate_relative_url=slave_instance.getRelativeUrl(),
...@@ -106,6 +108,7 @@ def SoftwareInstance_requestDestroySlaveInstanceRelated(self): ...@@ -106,6 +108,7 @@ def SoftwareInstance_requestDestroySlaveInstanceRelated(self):
limit=1, limit=1,
) )
if len(cleanup_packing_list) == 0: if len(cleanup_packing_list) == 0:
uid_list.append(slave_instance_uid)
slave_instance.requestDestroyComputerPartition() slave_instance.requestDestroyComputerPartition()
finally: finally:
# Restore the original user. # Restore the original user.
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_jump</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_jump</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>jump_to_related_usage_report_list</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>1.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Related Usage Reports</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string encoding="cdata"><![CDATA[
string:${object_url}/Base_jumpToRelatedObject?base_category=causality&portal_type=Usage+Report
]]></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_jump</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_jump</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>jump_to_related_usage_report_list</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>1.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Related Usage Reports</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string encoding="cdata"><![CDATA[
string:${object_url}/Base_jumpToRelatedObject?base_category=causality&portal_type=Usage+Report
]]></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -51,19 +51,11 @@ ...@@ -51,19 +51,11 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>portal = context.getPortalObject()\n <value> <string>portal = context.getPortalObject()\n
\n
build_before = None\n
if params is not None:\n
build_before = params.get(\'build_before\', None)\n
kw = {\'build_before\':build_before}\n
else:\n
kw = {}\n
\n
for business_process in [\n for business_process in [\n
portal.business_process_module.vifib_sale_business_process,\n portal.business_process_module.vifib_sale_business_process,\n
portal.business_process_module.vifib_purchase_business_process]:\n portal.business_process_module.vifib_purchase_business_process]:\n
for link in business_process.contentValues(portal_type="Business Link"):\n for link in business_process.contentValues(portal_type="Business Link"):\n
link.build(**kw)\n link.build()\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
......
489 490
\ No newline at end of file \ No newline at end of file
Computer Partition | jump_to_related_usage_report_list
System Preference | vifib_preference System Preference | vifib_preference
Virtio Partition | jump_to_related_usage_report_list
Virtio Partition | view Virtio Partition | view
\ No newline at end of file
import unittest import unittest
from Products.ERP5Type.tests.Sequence import SequenceList from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Type.DateUtils import getClosestDate, addToDate
from testVifibSlapWebService import TestVifibSlapWebServiceMixin from testVifibSlapWebService import TestVifibSlapWebServiceMixin
from Products.ERP5Type.DateUtils import getClosestDate
from DateTime.DateTime import DateTime from DateTime import DateTime
from testVifibOpenOrderSimulation import generateTimeFrameList
class TestVifibInstanceHostingRelatedDocument(TestVifibSlapWebServiceMixin): class TestVifibInstanceHostingRelatedDocument(TestVifibSlapWebServiceMixin):
def stepTriggerNextBuild(self, sequence, **kw): def stepTriggerBuild(self, sequence, **kw):
build_before = sequence.get('build_before') self.portal.portal_alarms.vifib_trigger_build.activeSense()
if build_before is None:
build_before = getClosestDate(
target_date=DateTime(), precision='month', before=0)
self.portal.portal_alarms.vifib_trigger_build.activeSense()
else:
build_before = addToDate(build_before, month=1)
self.portal.portal_alarms.vifib_trigger_build.activeSense(
params={'build_before':build_before})
sequence.edit(
number_of_sale_packing_list=sequence.get(
'number_of_sale_packing_list', 0) + 1,
invoice_amount=sequence.get('invoice_amount', 0) + 1,
payment_amount=sequence.get('payment_amount', 0) + 1,
build_before=build_before
)
def stepCheckOneMoreDocumentList(self, sequence, **kw): def stepCheckPayment(self, sequence, **kw):
hosting_subscription = self.portal.portal_catalog\ raise NotImplementedError
.getResultValue(uid=sequence['hosting_subscription_uid'])
sale_packing_list_list = self.portal.portal_catalog( def stepCheckSubscriptionSalePackingListCoverage(self, sequence, **kw):
hosting_subscription = self.portal.portal_catalog.getResultValue(
uid=sequence['hosting_subscription_uid'])
delivery_list = self.portal.portal_catalog(
portal_type='Sale Packing List', portal_type='Sale Packing List',
causality_relative_url=hosting_subscription.getRelativeUrl(), causality_relative_url=hosting_subscription.getRelativeUrl(),
sort_on=(('delivery.start_date', "DESC"))) sort_on=(('delivery.start_date', 'desc'),)
)
# is whole year covered?
self.assertEqual(12, len(delivery_list))
# generate the expected time frames
now = DateTime()
start_date = \
getClosestDate(target_date=now, precision='day', before=1)
self.assertEqual(sequence['number_of_sale_packing_list'], # Calculate the list of time frames
len(sale_packing_list_list)) expected_time_frame_list = generateTimeFrameList(start_date)
sale_packing_list = sale_packing_list_list[0].getObject() idx = 0
sale_invoice_transaction_list = sale_packing_list\ for delivery in delivery_list:
.getCausalityRelatedValueList(portal_type='Sale Invoice Transaction') expected_start_date = expected_time_frame_list[idx]
self.assertEqual(sequence['invoice_amount'], len(sale_invoice_transaction_list)) expected_stop_date = expected_time_frame_list[idx+1]
sale_invoice_transaction = sale_invoice_transaction_list[0] self.assertEqual(expected_start_date, delivery.getStartDate())
self.assertEqual(expected_stop_date, delivery.getStopDate())
payment_transaction_list = sale_invoice_transaction\ self.assertEqual(hosting_subscription.getRelativeUrl(),
.getCausalityRelatedValueList(portal_type='Payment Transaction') delivery.getCausality())
self.assertEqual(1, len(payment_transaction_list)) delivery_line_list = \
payment_transaction = payment_transaction_list[0] delivery.contentValues(portal_type="Sale Packing List Line")
self.assertEquals(1, len(delivery_line_list))
delivery_line = delivery_line_list[0]
self.assertEquals("organisation_module/vifib_internet",
delivery.getSource())
self.assertEquals("organisation_module/vifib_internet",
delivery.getSourceSection())
self.assertEquals("person_module/test_vifib_customer",
delivery.getDestination())
self.assertEquals("person_module/test_vifib_customer",
delivery.getDestinationSection())
self.assertEquals("currency_module/EUR",
delivery.getPriceCurrency())
# check sale packing list line related property
self.assertEquals("service_module/vifib_instance_subscription",
delivery_line.getResource())
self.assertEquals(1,
delivery_line.getQuantity())
self.assertEquals("unit/piece",
delivery_line.getQuantityUnit())
self.assertEquals(1,
delivery_line.getPrice())
# fetch open order, open order line and subscription
person = self.portal.person_module['test_vifib_customer']
open_order = \
person.getDestinationDecisionRelatedValue(portal_type="Open Sale Order")
open_order_line = \
open_order.contentValues(portal_type="Open Sale Order Line")[0]
# check related property
self.assertEquals(open_order_line.getSpecialise(),
delivery.getSpecialise())
idx += 1
def stepCheckHostingSubscriptionInitialDocumentCoverage(self, sequence, **kw):
catalog = self.portal.portal_catalog
hosting_resource = self.portal.portal_preferences\
.getPreferredInstanceHostingResource()
setup_resource = self.portal.portal_preferences\
.getPreferredInstanceSetupResource()
subscription_resource = self.portal.portal_preferences\
.getPreferredInstanceSubscriptionResource()
sequence.edit( sequence.edit(
current_sale_packing_list=sale_packing_list, hosting_resource=hosting_resource,
current_sale_invoice_transaction=sale_invoice_transaction, setup_resource=setup_resource,
current_payment_transaction=payment_transaction subscription_resource=subscription_resource
) )
def stepCheckSalePackingList(self, sequence, **kw): hosting_subscription = catalog.getResultValue(
# check one more sale packing list is generated uid=sequence['hosting_subscription_uid'])
# and only one sale packing list line is inside hosting_subscription_url = hosting_subscription.getRelativeUrl()
sale_packing_list = sequence['current_sale_packing_list']
sale_packing_list_line_list = \ # hosting is confirmed, so no invoice
sale_packing_list.contentValues(portal_type="Sale Packing List Line") hosting_delivery_line_list = catalog(portal_type='Sale Packing List Line',
self.assertEquals(1, len(sale_packing_list_line_list)) aggregate_relative_url=hosting_subscription_url,
sale_packing_list_line = sale_packing_list_line_list[0] resource_relative_url=hosting_resource)
# check sale packing list related property self.assertEqual(1, len(hosting_delivery_line_list))
self.assertEquals("organisation_module/vifib_internet", self.assertEqual('confirmed', hosting_delivery_line_list[0]\
sale_packing_list.getSource()) .getSimulationState())
self.assertEquals("organisation_module/vifib_internet",
sale_packing_list.getSourceSection()) hosting_invoice_line_list = catalog(portal_type='Invoice Line',
self.assertEquals("person_module/test_vifib_customer", aggregate_relative_url=hosting_subscription_url,
sale_packing_list.getDestination()) resource_relative_url=hosting_resource)
self.assertEquals("person_module/test_vifib_customer", self.assertEqual(0, len(hosting_invoice_line_list))
sale_packing_list.getDestinationSection())
self.assertEquals("currency_module/EUR", # setup is stopped, and has there is invoice
sale_packing_list.getPriceCurrency()) setup_delivery_line_list = catalog(portal_type='Sale Packing List Line',
aggregate_relative_url=hosting_subscription_url,
# check sale packing list line related property resource_relative_url=setup_resource)
self.assertEquals("service_module/vifib_instance_subscription",
sale_packing_list_line.getResource()) self.assertEqual(1, len(setup_delivery_line_list))
self.assertEquals(1, self.assertEqual('stopped', setup_delivery_line_list[0]\
sale_packing_list_line.getQuantity()) .getSimulationState())
self.assertEquals("unit/piece",
sale_packing_list_line.getQuantityUnit()) setup_invoice_line_list = catalog(portal_type='Invoice Line',
self.assertEquals(1, aggregate_relative_url=hosting_subscription_url,
sale_packing_list_line.getPrice()) resource_relative_url=setup_resource)
self.assertEqual(1, len(setup_invoice_line_list))
# fetch open order, open order line and subscription self.assertEqual('planned', setup_invoice_line_list[0]\
person = self.portal.person_module['test_vifib_customer'] .getSimulationState())
open_order = \
person.getDestinationDecisionRelatedValue(portal_type="Open Sale Order") # there are 12 confirmed subscription, so no invoice
open_order_line = \ subscription_delivery_line_list = catalog(
open_order.contentValues(portal_type="Open Sale Order Line")[0] portal_type='Sale Packing List Line',
aggregate_relative_url=hosting_subscription_url,
# check related property resource_relative_url=subscription_resource,
self.assertEquals(open_order_line.getSpecialise(), sort_on=(('movement.start_date', 'desc'),)
sale_packing_list.getSpecialise()) )
def stepCheckInvoiceAndInvoiceTransaction(self, sequence, **kw): self.assertEqual(12, len(subscription_delivery_line_list))
sale_invoice_transaction = sequence['current_sale_invoice_transaction'] self.assertEqual(['confirmed'] * 12, [q.getSimulationState() for \
self.assertEqual(sale_invoice_transaction.getSimulationState(), q in subscription_delivery_line_list])
'confirmed')
self.assertEqual(sale_invoice_transaction.getCausalityList(), subscription_invoice_line_list = catalog(portal_type='Invoice Line',
[sequence['current_sale_packing_list'].getRelativeUrl()]) aggregate_relative_url=hosting_subscription_url,
self.portal.portal_workflow.doActionFor(sale_invoice_transaction, resource_relative_url=subscription_resource)
'start_action') self.assertEqual(0, len(subscription_invoice_line_list))
self.assertEqual(sale_invoice_transaction.getSimulationState(),
'started') # invoice shall be solved
self.assertEqual('solved', setup_invoice_line_list[0].getCausalityState())
# invoice shall have causality of one packing list
self.assertEqual(
[setup_delivery_line_list[0].getParentValue().getUid()],
setup_invoice_line_list[0].getParentValue().getCausalityUidList())
sequence.edit(
subscription_delivery_uid_list=[q.getParentValue().getUid() for q in \
subscription_delivery_line_list]
)
def stepSelectNextSubscriptionDelivery(self, sequence, **kw):
subscription_delivery_uid_list = sequence['subscription_delivery_uid_list']
subscription_delivery_uid_list.reverse()
subscription_delivery_uid = subscription_delivery_uid_list.pop()
subscription_delivery_uid_list.reverse()
sequence.edit(
subscription_delivery_uid_list=subscription_delivery_uid_list,
subscription_delivery_uid=subscription_delivery_uid
)
def stepStartSubscriptionDelivery(self, sequence, **kw):
self.portal.portal_catalog.getResultValue(
uid=sequence['subscription_delivery_uid']).start()
def stepStopSubscriptionDelivery(self, sequence, **kw):
self.portal.portal_catalog.getResultValue(
uid=sequence['subscription_delivery_uid']).stop()
def stepCheckHostingSubscriptionStoppedDocumentCoverage(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('planned', setup_invoice_line_list[0]\
.getSimulationState())
# there are 11 confirmed and 1 stopped subscription, so 1 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'] * 11) + ['stopped'],
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(1, len(subscription_invoice_line_list))
self.assertEqual('planned', subscription_invoice_line_list[0]\
.getSimulationState())
# there are two invoice lines sharing same invoice
self.assertEqual(
setup_invoice_line_list[0].getParentValue().getRelativeUrl(),
subscription_invoice_line_list[0].getParentValue().getRelativeUrl()
)
# invoice shall be solved
self.assertEqual('solved', setup_invoice_line_list[0].getCausalityState())
# 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']),
sorted(setup_invoice_line_list[0].getParentValue().getCausalityUidList()))
def stepCheckPayment(self, sequence, **kw):
payment_transaction = sequence['current_payment_transaction']
self.assertEqual(payment_transaction.getSimulationState(), 'planned')
self.assertEqual(payment_transaction.getCausalityList(),
[sequence['current_sale_invoice_transaction'].getRelativeUrl()])
self.portal.portal_workflow.doActionFor(payment_transaction,
'confirm_action')
self.assertEqual(payment_transaction.getSimulationState(),
'confirmed')
def test_OpenOrder_sale_packing_list(self): def test_OpenOrder_sale_packing_list(self):
""" """
Check that sale_packing_list is generated properly from simulation Check that sale_packing_list is generated properly from simulation
""" """
check_one_month = """
LoginDefaultUser
TriggerNextBuild
Tic
Logout
LoginDefaultUser
CheckOneMoreDocumentList
CheckSalePackingList
CheckInvoiceAndInvoiceTransaction
CheckPayment
Logout
"""
self.computer_partition_amount = 1
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = \ sequence_string = \
self.prepare_installed_computer_partition_sequence_string \ self.prepare_installed_computer_partition_sequence_string + \
+ (check_one_month * 12) """
LoginDefaultUser
TriggerBuild
Tic
CheckSubscriptionSalePackingListCoverage
TriggerBuild
Tic
# Nothing shall change
CheckHostingSubscriptionInitialDocumentCoverage
# Stop first Subscriptoin delivery and after triggering build check
# that invoice got updated
SelectNextSubscriptionDelivery
StartSubscriptionDelivery
StopSubscriptionDelivery
Tic
TriggerBuild
Tic
CheckHostingSubscriptionStoppedDocumentCoverage
CheckPayment
"""
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
......
...@@ -5,6 +5,14 @@ from testVifibSlapWebService import TestVifibSlapWebServiceMixin ...@@ -5,6 +5,14 @@ from testVifibSlapWebService import TestVifibSlapWebServiceMixin
from DateTime.DateTime import DateTime from DateTime.DateTime import DateTime
def generateTimeFrameList(start_date):
expected_time_frame_list = [start_date]
current = \
getClosestDate(target_date=start_date, precision='month', before=0)
for m in range(0, 12):
expected_time_frame_list.append(addToDate(current, month=m))
return expected_time_frame_list
class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin): class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin):
def stepCheckSimulationMovement(self, sequence, **kw): def stepCheckSimulationMovement(self, sequence, **kw):
...@@ -76,37 +84,25 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin): ...@@ -76,37 +84,25 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin):
0.0, open_order_line.getStopDate().second()) 0.0, open_order_line.getStopDate().second())
# Calculate the list of time frames # Calculate the list of time frames
expected_time_frame_list = [start_date] expected_time_frame_list = generateTimeFrameList(start_date)
current = \
getClosestDate(target_date=start_date, precision='month', before=0) # test the test: have we generated 12th next months coverage?
if start_date == current: self.assertEqual(13, len(expected_time_frame_list))
current = addToDate(start_date, month=1)
while current <= stop_date:
expected_time_frame_list.append(current)
current = addToDate(
getClosestDate(target_date=current, precision='month', before=0),
month=1)
# Check that simulation is created by the periodicity simulation_movement_list = self.portal.portal_catalog(
self.assertEquals(len(expected_time_frame_list), portal_type='Simulation Movement',
len(applied_rule.contentValues()) + 1) parent_uid=applied_rule.getUid(),
sort_on=(('movement.start_date', 'desc'),)
)
# Check that simulation is created by the periodicity for one year
self.assertEquals(12,
len(simulation_movement_list))
# Check the list of expected simulation # Check the list of expected simulation
idx = 0 idx = 0
while idx + 1 < len(expected_time_frame_list): for simulation_movement in simulation_movement_list:
# select simulation given start_date and stop_date expected_start_date = expected_time_frame_list[idx]
simulation_movement_list = \ expected_stop_date = expected_time_frame_list[idx+1]
self.portal.portal_catalog.unrestrictedSearchResults(
parent_uid=applied_rule.getUid(),
portal_type="Simulation Movement",
**{
'movement.start_date':expected_time_frame_list[idx],
'movement.stop_date':expected_time_frame_list[idx + 1],
})
self.assertEquals(1, len(simulation_movement_list))
simulation_movement = simulation_movement_list[0].getObject()
self.assertNotEquals(None, simulation_movement)
# Check simulation movement property # Check simulation movement property
self.assertEquals(1.0, self.assertEquals(1.0,
simulation_movement.getQuantity()) simulation_movement.getQuantity())
...@@ -144,6 +140,13 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin): ...@@ -144,6 +140,13 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin):
self.assertEquals(None, self.assertEquals(None,
simulation_movement.getAggregate( simulation_movement.getAggregate(
portal_type="Software Release")) portal_type="Software Release"))
self.assertEqual(expected_start_date, simulation_movement.getStartDate())
self.assertEqual(expected_stop_date, simulation_movement.getStopDate())
# not delivered yet
self.assertEqual(None, simulation_movement.getDelivery())
# packing list shall be buildable
self.assertTrue(simulation_movement.isBuildable())
# fetch invoice level simulation # fetch invoice level simulation
applied_rule_invoice_list = \ applied_rule_invoice_list = \
...@@ -159,6 +162,11 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin): ...@@ -159,6 +162,11 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin):
simulation_movement_invoice_list[0].getObject() simulation_movement_invoice_list[0].getObject()
self.assertNotEquals(None, simulation_movement_invoice) self.assertNotEquals(None, simulation_movement_invoice)
# not delivered yet
self.assertEqual(None, simulation_movement_invoice.getDelivery())
# invoice shall be not yet buildable
self.assertFalse(False, simulation_movement_invoice.isBuildable())
# check property of invoice simulation # check property of invoice simulation
self.assertEquals(1.0, self.assertEquals(1.0,
simulation_movement_invoice.getQuantity()) simulation_movement_invoice.getQuantity())
...@@ -182,9 +190,9 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin): ...@@ -182,9 +190,9 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin):
simulation_movement_invoice.getResource()) simulation_movement_invoice.getResource())
self.assertEquals("vifib/invoicing", self.assertEquals("vifib/invoicing",
simulation_movement_invoice.getTradePhase()) simulation_movement_invoice.getTradePhase())
self.assertEquals(expected_time_frame_list[idx+1], self.assertEquals(expected_start_date,
simulation_movement_invoice.getStartDate()) simulation_movement_invoice.getStartDate())
self.assertEquals(expected_time_frame_list[idx+1], self.assertEquals(expected_stop_date,
simulation_movement_invoice.getStopDate()) simulation_movement_invoice.getStopDate())
self.assertEquals(None, self.assertEquals(None,
simulation_movement_invoice.getAggregate( simulation_movement_invoice.getAggregate(
...@@ -215,6 +223,10 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin): ...@@ -215,6 +223,10 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin):
simulation_movement_invoice_transaction_debit = None simulation_movement_invoice_transaction_debit = None
for simulation_movement_invoice_transaction in \ for simulation_movement_invoice_transaction in \
simulation_movement_invoice_transaction_list: simulation_movement_invoice_transaction_list:
# not delivered nor buildable
self.assertEqual(None, simulation_movement_invoice_transaction\
.getDelivery())
self.assertFalse(simulation_movement_invoice_transaction.isBuildable())
if "business_process_module/vifib_sale_business_process/account_credit_path" \ if "business_process_module/vifib_sale_business_process/account_credit_path" \
in simulation_movement_invoice_transaction.getCausalityList(): in simulation_movement_invoice_transaction.getCausalityList():
simulation_movement_invoice_transaction_credit = \ simulation_movement_invoice_transaction_credit = \
...@@ -224,7 +236,17 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin): ...@@ -224,7 +236,17 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin):
simulation_movement_invoice_transaction_debit = \ simulation_movement_invoice_transaction_debit = \
simulation_movement_invoice_transaction.getObject() simulation_movement_invoice_transaction.getObject()
self.assertNotEquals(None, simulation_movement_invoice_transaction_credit) self.assertNotEquals(None, simulation_movement_invoice_transaction_credit)
# not delivered nor buildable
self.assertEqual(None, simulation_movement_invoice_transaction_credit\
.getDelivery())
self.assertFalse(simulation_movement_invoice_transaction_credit\
.isBuildable())
self.assertNotEquals(None, simulation_movement_invoice_transaction_debit) self.assertNotEquals(None, simulation_movement_invoice_transaction_debit)
# not delivered nor buildable
self.assertEqual(None, simulation_movement_invoice_transaction_debit\
.getDelivery())
self.assertFalse(simulation_movement_invoice_transaction_debit\
.isBuildable())
# check property of invoice transaction simulation # check property of invoice transaction simulation
self.assertEquals(-1.0, self.assertEquals(-1.0,
...@@ -249,9 +271,9 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin): ...@@ -249,9 +271,9 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin):
simulation_movement_invoice_transaction_credit.getSpecialise()) simulation_movement_invoice_transaction_credit.getSpecialise())
self.assertEquals("vifib/accounting", self.assertEquals("vifib/accounting",
simulation_movement_invoice_transaction_credit.getTradePhase()) simulation_movement_invoice_transaction_credit.getTradePhase())
self.assertEquals(expected_time_frame_list[idx+1], self.assertEquals(expected_start_date,
simulation_movement_invoice_transaction_credit.getStartDate()) simulation_movement_invoice_transaction_credit.getStartDate())
self.assertEquals(expected_time_frame_list[idx+1], self.assertEquals(expected_stop_date,
simulation_movement_invoice_transaction_credit.getStopDate()) simulation_movement_invoice_transaction_credit.getStopDate())
self.assertEquals(1.0, self.assertEquals(1.0,
...@@ -276,9 +298,9 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin): ...@@ -276,9 +298,9 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin):
simulation_movement_invoice_transaction_debit.getSpecialise()) simulation_movement_invoice_transaction_debit.getSpecialise())
self.assertEquals("vifib/accounting", self.assertEquals("vifib/accounting",
simulation_movement_invoice_transaction_debit.getTradePhase()) simulation_movement_invoice_transaction_debit.getTradePhase())
self.assertEquals(expected_time_frame_list[idx+1], self.assertEquals(expected_start_date,
simulation_movement_invoice_transaction_debit.getStartDate()) simulation_movement_invoice_transaction_debit.getStartDate())
self.assertEquals(expected_time_frame_list[idx+1], self.assertEquals(expected_stop_date,
simulation_movement_invoice_transaction_debit.getStopDate()) simulation_movement_invoice_transaction_debit.getStopDate())
# credit simulation movement has no content # credit simulation movement has no content
...@@ -311,7 +333,17 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin): ...@@ -311,7 +333,17 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin):
simulation_movement_credit_payment_debit = \ simulation_movement_credit_payment_debit = \
simulation_movement_credit_payment.getObject() simulation_movement_credit_payment.getObject()
self.assertNotEquals(None, simulation_movement_credit_payment_credit) self.assertNotEquals(None, simulation_movement_credit_payment_credit)
# not delivered nor buildable
self.assertEqual(None, simulation_movement_credit_payment_credit\
.getDelivery())
self.assertFalse(simulation_movement_credit_payment_credit\
.isBuildable())
self.assertNotEquals(None, simulation_movement_credit_payment_debit) self.assertNotEquals(None, simulation_movement_credit_payment_debit)
# not delivered nor buildable
self.assertEqual(None, simulation_movement_credit_payment_debit\
.getDelivery())
self.assertFalse(simulation_movement_credit_payment_debit\
.isBuildable())
# check payment level of simulation # check payment level of simulation
self.assertEquals(-1.0, self.assertEquals(-1.0,
...@@ -334,9 +366,9 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin): ...@@ -334,9 +366,9 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin):
simulation_movement_credit_payment_credit.getSpecialise()) simulation_movement_credit_payment_credit.getSpecialise())
self.assertEquals("vifib/payment", self.assertEquals("vifib/payment",
simulation_movement_credit_payment_credit.getTradePhase()) simulation_movement_credit_payment_credit.getTradePhase())
self.assertEquals(expected_time_frame_list[idx+1], self.assertEquals(expected_start_date,
simulation_movement_credit_payment_credit.getStartDate()) simulation_movement_credit_payment_credit.getStartDate())
self.assertEquals(expected_time_frame_list[idx+1], self.assertEquals(expected_stop_date,
simulation_movement_credit_payment_credit.getStopDate()) simulation_movement_credit_payment_credit.getStopDate())
self.assertEquals(1.0, self.assertEquals(1.0,
...@@ -359,9 +391,9 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin): ...@@ -359,9 +391,9 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin):
simulation_movement_credit_payment_debit.getSpecialise()) simulation_movement_credit_payment_debit.getSpecialise())
self.assertEquals("vifib/payment", self.assertEquals("vifib/payment",
simulation_movement_credit_payment_debit.getTradePhase()) simulation_movement_credit_payment_debit.getTradePhase())
self.assertEquals(expected_time_frame_list[idx+1], self.assertEquals(expected_start_date,
simulation_movement_credit_payment_debit.getStartDate()) simulation_movement_credit_payment_debit.getStartDate())
self.assertEquals(expected_time_frame_list[idx+1], self.assertEquals(expected_stop_date,
simulation_movement_credit_payment_debit.getStopDate()) simulation_movement_credit_payment_debit.getStopDate())
# check next simulation movement # check next simulation movement
...@@ -376,7 +408,7 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin): ...@@ -376,7 +408,7 @@ class TestVifibOpenOrderSimulation(TestVifibSlapWebServiceMixin):
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_string = \ sequence_string = \
self.prepare_installed_computer_partition_sequence_string + """ self.prepare_installed_computer_partition_sequence_string + """
LoginDefaultUser LoginERP5TypeTestCase
CheckSimulationMovement CheckSimulationMovement
Tic Tic
SlapLogout SlapLogout
......
...@@ -1226,7 +1226,7 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin): ...@@ -1226,7 +1226,7 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin):
filter_kw=sequence.get('requested_filter_dict', {}), filter_kw=sequence.get('requested_filter_dict', {}),
state=sequence.get('instance_state')) state=sequence.get('instance_state'))
requested_slap_computer_partition = slap_computer_partition.request(**kw) slap_computer_partition.request(**kw)
def stepCheckRequestComputerPartitionWithAnotherSoftwareType( def stepCheckRequestComputerPartitionWithAnotherSoftwareType(
self, sequence, **kw): self, sequence, **kw):
......
from Products.ERP5Type.tests.Sequence import SequenceList from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Type.tests.backportUnittest import expectedFailure
import unittest import unittest
from testVifibSlapWebService import TestVifibSlapWebServiceMixin from testVifibSlapWebService import TestVifibSlapWebServiceMixin
from slapos import slap from slapos import slap
...@@ -131,7 +130,7 @@ class TestVifibSlapOpenOrderRequest(TestVifibSlapWebServiceMixin): ...@@ -131,7 +130,7 @@ class TestVifibSlapOpenOrderRequest(TestVifibSlapWebServiceMixin):
self.slap = slap.slap() self.slap = slap.slap()
self.slap.initializeConnection(self.server_url, timeout=None) self.slap.initializeConnection(self.server_url, timeout=None)
open_order = self.slap.registerOpenOrder() open_order = self.slap.registerOpenOrder()
requested_slap_computer_partition = open_order.request( open_order.request(
software_release=software_release, software_release=software_release,
software_type="SecondSoftwareType", software_type="SecondSoftwareType",
partition_reference=sequence['requested_reference'], partition_reference=sequence['requested_reference'],
......
...@@ -31,7 +31,6 @@ from DateTime import DateTime ...@@ -31,7 +31,6 @@ from DateTime import DateTime
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.Errors import UnsupportedWorkflowMethod from Products.ERP5Type.Errors import UnsupportedWorkflowMethod
from Products.ERP5Type.tests.Sequence import SequenceList from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Type.tests.backportUnittest import expectedFailure
from Products.ERP5Type.tests.backportUnittest import skip from Products.ERP5Type.tests.backportUnittest import skip
from Products.ERP5Type.tests.SecurityTestCase import AssertNoPermissionMethod, \ from Products.ERP5Type.tests.SecurityTestCase import AssertNoPermissionMethod, \
AssertPermissionMethod AssertPermissionMethod
...@@ -4179,7 +4178,7 @@ class TestVifibSlapWebService(TestVifibSlapWebServiceMixin): ...@@ -4179,7 +4178,7 @@ class TestVifibSlapWebService(TestVifibSlapWebServiceMixin):
def stepPersonRequestCredentialUpdate(self, sequence, **kw): def stepPersonRequestCredentialUpdate(self, sequence, **kw):
sequence['updated_last_name'] = 'Another' sequence['updated_last_name'] = 'Another'
result = self.portal.ERP5Site_newPersonCredentialUpdate( self.portal.ERP5Site_newPersonCredentialUpdate(
first_name='Homer', first_name='Homer',
last_name=sequence['updated_last_name'], last_name=sequence['updated_last_name'],
reference=sequence['web_user'], reference=sequence['web_user'],
......
...@@ -790,6 +790,73 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin): ...@@ -790,6 +790,73 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin):
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
def test_SlaveInstance_destroy_slave_with_SlaveInstance_stopped(self):
"""
Check that request destroy from Software Instance when exists one Slave
Instance stopped, both instances will be destroyed correctly
Scenario:
1. request master instance
2. request Slave Instance
3. stop Slave Instance
4. request destroy the master instance
Both instances must be destroyed
"""
sequence_list = SequenceList()
sequence_string = self.prepare_install_requested_computer_partition_sequence_string + """
Tic
SlapLoginCurrentComputer
SoftwareInstanceAvailable
Tic
CheckEmptySlaveInstanceListFromOneComputerPartition
SlapLoginCurrentSoftwareInstance
SelectEmptyRequestedParameterDict
SetRandomRequestedReference
RequestSlaveInstanceFromComputerPartition
SlapLogout
LoginDefaultUser
ConfirmOrderedSaleOrderActiveSense
Tic
Logout
SlapLoginCurrentSoftwareInstance
RequestSlaveInstanceFromComputerPartition
SlapLogout
SlapLoginCurrentComputer
SoftwareInstanceAvailable
Tic
LoginDefaultUser
StartSoftwareInstanceFromCurrentComputerPartition
Logout
Tic
SoftwareInstanceStarted
Tic
SlapLogout
LoginDefaultUser
SelectSlaveInstanceFromOneComputerPartition
SlapLoginCurrentSoftwareInstance
RequestSoftwareInstanceStop
Tic
SlaveInstanceStopped
Tic
CheckComputerPartitionInstanceHostingSalePackingListStarted
CheckComputerPartitionInstanceHostingSalePackingListDelivered
SetDeliveryLineAmountEqualTwo
CheckComputerPartitionInstanceSetupSalePackingListStopped
RequestDestroySoftwareInstanceFromCurrentComputerPartition
Tic
CheckComputerPartitionInstanceCleanupSalePackingListConfirmed
Logout
SlapLoginCurrentComputer
SoftwareInstanceDestroyed
Tic
LoginDefaultUser
CheckComputerPartitionIsFree
CheckComputerPartitionInstanceCleanupSalePackingListDelivered
CheckComputerPartitionInstanceSetupSalePackingListDelivered
"""
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_Security_after_destroy_SoftwareInstance_with_different_user(self): def test_Security_after_destroy_SoftwareInstance_with_different_user(self):
""" """
Check that destroying one Software Instance it will not destroy Slave Check that destroying one Software Instance it will not destroy Slave
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
############################################################################# #############################################################################
import unittest import unittest
from DateTime import DateTime
from lxml import etree from lxml import etree
from slapos import slap from slapos import slap
from testVifibSlapWebService import TestVifibSlapWebServiceMixin from testVifibSlapWebService import TestVifibSlapWebServiceMixin
......
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