Commit b78fb010 authored by Ayush Tiwari's avatar Ayush Tiwari

Update item_path_list in Business Mangager only when manager is already set

parent b07a8646
...@@ -737,24 +737,25 @@ class BusinessItem(XMLObject): ...@@ -737,24 +737,25 @@ class BusinessItem(XMLObject):
# Update the Business Manager with the path list everytime after editing # Update the Business Manager with the path list everytime after editing
# item_path # item_path
manager = self.getFollowUpValue() manager = self.getFollowUpValue()
# Check if the manager has already been set or not
# Copy the path list for Business Manager and update it with new path if manager:
item_path_list = manager.getItemPathList()[:] # Copy the path list for Business Manager and update it with new path
old_item_path = self._v_modified_property_dict.get('item_path') item_path_list = manager.getItemPathList()[:]
if old_item_path and item_path_list: old_item_path = self._v_modified_property_dict.get('item_path')
if old_item_path in item_path_list: if old_item_path and item_path_list:
for idx, item in enumerate(item_path_list): if old_item_path in item_path_list:
if item == old_item_path: for idx, item in enumerate(item_path_list):
item_path_list[idx] = self.getProperty('item_path') if item == old_item_path:
item_path_list[idx] = self.getProperty('item_path')
else:
item_path_list.append(self.getProperty('item_path'))
else: else:
# If there is no old_item_path or if path_list is empty, we can just
# append the new_path in path_list
item_path_list.append(self.getProperty('item_path')) item_path_list.append(self.getProperty('item_path'))
else:
# If there is no old_item_path or if path_list is empty, we can just
# append the new_path in path_list
item_path_list.append(self.getProperty('item_path'))
# Update the manager with new path list # Update the manager with new path list
manager.setProperty('item_path_list', item_path_list) manager.setProperty('item_path_list', item_path_list)
def build(self, context, **kw): def build(self, context, **kw):
""" """
......
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