Commit ed1dc79c authored by Paul Graydon's avatar Paul Graydon

wendelin_telecom_base: Fix edge case in ERP5Site_registerOrs

parent 546a7e2e
......@@ -41,10 +41,14 @@ ors_hostname, ors_comp_id = fluentbit_tag_components[0], fluentbit_tag_component
fluentbit_tag_prefix = '%s_%s' % (ors_hostname, ors_comp_id)
# Detect the case where an existing ORS has changed the last component of its tag (i.e. its radio ID):
# Search for all Data Acquisition Units with the same first two tag components and get their related destination_project
# Search for all validated Data Acquisition Units with the same first two tag components
# and get their related destination_project
related_data_acquisition_unit_list = [
related_data_acquisition_unit for related_data_acquisition_unit \
in portal.data_acquisition_unit_module.contentValues(filter={'portal_type': 'Data Acquisition Unit'}) \
in portal.data_acquisition_unit_module.searchFolder(
portal_type='Data Acquisition Unit',
validation_state='validated'
) \
if related_data_acquisition_unit.getReference().startswith(fluentbit_tag_prefix)
]
destination_project = None
......@@ -52,6 +56,9 @@ if related_data_acquisition_unit_list:
related_destination_project_list = []
for related_data_acquisition_unit in related_data_acquisition_unit_list:
related_data_supply = related_data_acquisition_unit.DataAcquisitionUnit_getOrsDataSupply()
# Non-standard ORS
if related_data_supply is None:
continue
related_destination_project = related_data_supply.getDestinationProject()
if related_destination_project:
related_destination_project_list.append(related_destination_project)
......
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