Fix MSProject relationship_id issue at import

This commit is contained in:
bosonprojets
2021-05-06 06:19:40 +00:00
parent a10f4c070a
commit 764b880ea8
+3 -6
View File
@@ -45,12 +45,14 @@ class MSP2Ifc:
def parse_relationship_xml(self, task): def parse_relationship_xml(self, task):
relationships = {} relationships = {}
id = 0
if task.findall("pr:PredecessorLink", self.ns): if task.findall("pr:PredecessorLink", self.ns):
for relationship in task.findall("pr:PredecessorLink", self.ns): for relationship in task.findall("pr:PredecessorLink", self.ns):
relationships[task.find("pr:UID", self.ns).text] = { relationships[id] = {
"PredecessorTask": relationship.find("pr:PredecessorUID", self.ns).text, "PredecessorTask": relationship.find("pr:PredecessorUID", self.ns).text,
"Type": relationship.find("pr:Type", self.ns).text "Type": relationship.find("pr:Type", self.ns).text
} }
id += 1
return relationships return relationships
def parse_task_xml(self, project): def parse_task_xml(self, project):
@@ -59,11 +61,6 @@ class MSP2Ifc:
task_index_level = task.find("pr:OutlineLevel", self.ns).text task_index_level = task.find("pr:OutlineLevel", self.ns).text
wbs_id = task.find("pr:WBS", self.ns).text wbs_id = task.find("pr:WBS", self.ns).text
relationships = self.parse_relationship_xml(task) relationships = self.parse_relationship_xml(task)
# for relationship in task.findall("pr:PredecessorLink", self.ns):
# predecessor_task = relationship.find("pr:PredecessorUID", self.ns).text
# type = relationship.find("pr:Type", self.ns).text
outline_level = int(task.find("pr:OutlineLevel", self.ns).text) outline_level = int(task.find("pr:OutlineLevel", self.ns).text)
if outline_level != 0: if outline_level != 0: