Commit e165743c authored by Gabriel Monnerat's avatar Gabriel Monnerat

Refactor code to find correctly a Software Instance, because if...

Refactor code to find correctly a Software Instance, because if slave_reference is None the query must ensure that Slave Instance will be ignored
parent 4e16de14
......@@ -774,10 +774,14 @@ class SlapTool(BaseTool):
state_list.extend(portal.getPortalCurrentInventoryStateList())
state_list.extend(portal.getPortalReservedInventoryStateList())
state_list.extend(portal.getPortalTransitInventoryStateList())
aggregate_dict = {"aggregate_relative_url" : \
computer_partition_document.getRelativeUrl()}
if slave_reference is not None:
aggregate_dict["aggregate_reference"] = slave_reference
query = ComplexQuery(Query(aggregate_reference=slave_reference),
Query(aggregate_relative_url=computer_partition_document.getRelativeUrl()),
operator="AND")
else:
query = ComplexQuery(Query(aggregate_portal_type="Software Instance"),
Query(aggregate_relative_url=computer_partition_document.getRelativeUrl()),
operator="AND")
# Use getTrackingList
catalog_result = portal.portal_catalog(
......@@ -786,7 +790,7 @@ class SlapTool(BaseTool):
default_resource_uid=service_uid_list,
sort_on=(('movement.start_date', 'DESC'),),
limit=1,
**aggregate_dict
query=query
)
if len(catalog_result):
return catalog_result[0].getObject()
......
......@@ -4725,7 +4725,7 @@ class TestVifibSlapWebService(testVifibMixin):
Tic
Logout
LoginDefaultUser
CheckComputerPartitionInstanceHostingSalePackingListConfirmed
CheckComputerPartitionInstanceSetupSalePackingListConfirmed
Logout
"""
sequence_list.addSequenceString(sequence_string)
......@@ -4752,7 +4752,7 @@ class TestVifibSlapWebService(testVifibMixin):
Tic
Logout
LoginDefaultUser
CheckComputerPartitionInstanceHostingSalePackingListStopped
CheckComputerPartitionInstanceSetupSalePackingListStopped
Logout
"""
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