Commit da7d7b10 authored by Eteri's avatar Eteri

erp5_project: also delete related data ingestion after deleting a project

parent 097ccea2
......@@ -3,6 +3,7 @@ error_list = []
data_supply_set = set(state_change['object'].getRelatedValueList(portal_type="Data Supply"))
data_analysis_set = set(state_change['object'].getRelatedValueList(portal_type="Data Analysis"))
data_ingestion_set = set(state_change['object'].getRelatedValueList(portal_type="Data Ingestion"))
if not data_supply_set:
......@@ -17,6 +18,14 @@ else:
error_list.append(state_change['object'].Base_translateString("Error: Project contains active measurement position(s). It can not be invalidated, suspended or deleted."))
raise ValidationFailed, error_list
for data_ingestion in data_ingestion_set:
if data_ingestion.getSimulationState() != "started":
if data_ingestion.getSimulationState() != "deleted":
data_ingestion.delete()
else:
error_list.append(state_change['object'].Base_translateString("Error: Project contains active measurement position(s). It can not be invalidated, suspended or deleted."))
raise ValidationFailed, error_list
for data_analysis in data_analysis_set:
if data_analysis.getSimulationState() != "started":
if data_analysis.getSimulationState() != "deleted":
......
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