Fix bug where unassigning a document was too aggressive and deleted relationships where it shouldn't.

This commit is contained in:
Dion Moult
2023-04-10 22:26:58 +10:00
parent f8923709f6
commit fd989733c7
3 changed files with 83 additions and 1 deletions
@@ -58,4 +58,7 @@ class Usecase:
def execute(self):
for rel in self.settings["product"].HasAssociations:
if rel.is_a("IfcRelAssociatesDocument") and rel.RelatingDocument == self.settings["document"]:
self.file.remove(rel)
if len(rel.RelatedObjects) == 1:
self.file.remove(rel)
else:
rel.RelatedObjects = [o for o in rel.RelatedObjects if o != self.settings["product"]]