Commit d7b27ef1 authored by Tristan Cavelier's avatar Tristan Cavelier Committed by Sebastien Robin

Make sure the item is not set to None when building

In products/ERP5/Document/BusinessTemplate.py, when trying to build
an item, an error occured because item was set to None by clean method.
parent 598f9940
...@@ -5001,6 +5001,8 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -5001,6 +5001,8 @@ Business Template is a set of definitions, such as skins, portal types and categ
# Build each part # Build each part
for item_name in self._item_name_list: for item_name in self._item_name_list:
item = getattr(self, item_name) item = getattr(self, item_name)
if item is None:
continue
if self.getBtForDiff(): if self.getBtForDiff():
item.is_bt_for_diff = 1 item.is_bt_for_diff = 1
item.build(self) item.build(self)
...@@ -5559,7 +5561,9 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -5559,7 +5561,9 @@ Business Template is a set of definitions, such as skins, portal types and categ
# Export each part # Export each part
for item_name in self._item_name_list: for item_name in self._item_name_list:
getattr(self, item_name).export(context=self, bta=bta) item = getattr(self, item_name, None)
if item is not None:
item.export(context=self, bta=bta)
return bta.finishCreation() return bta.finishCreation()
......
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