From c4a4ee2a71036be7fe610e70c2e185f8899d6bbf Mon Sep 17 00:00:00 2001 From: Yusei Tahara <yusei@nexedi.com> Date: Fri, 19 Aug 2016 07:31:32 +0200 Subject: [PATCH] BusinessTemplate: Installed business template may be empty. Don't assume that it is not empty. --- product/ERP5/Document/BusinessTemplate.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py index da3081765d..a509a9e75e 100644 --- a/product/ERP5/Document/BusinessTemplate.py +++ b/product/ERP5/Document/BusinessTemplate.py @@ -2782,8 +2782,11 @@ class PortalTypeAllowedContentTypeTemplateItem(BaseTemplateItem): force = kw.get('force') installed_bt = kw.get('installed_bt') if installed_bt is not None: - old_objects = getattr(installed_bt, - self.business_template_class_property)._objects + item = getattr(installed_bt, self.business_template_class_property, None) + if item is not None: + old_objects = item._objects + else: + old_objects = {} else: old_objects = {} for key in set(self._objects.keys()).union(old_objects.keys()): -- 2.30.9