Commit 1ae2c8db authored by Aurel's avatar Aurel

make include of subcategories recusirve


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4592 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b6cc0b85
...@@ -640,18 +640,14 @@ class CategoryTemplateItem(ObjectTemplateItem): ...@@ -640,18 +640,14 @@ class CategoryTemplateItem(ObjectTemplateItem):
def build_sub_objects(self, context, id_list, url, **kw): def build_sub_objects(self, context, id_list, url, **kw):
p = context.getPortalObject() p = context.getPortalObject()
sub_list = {}
for id in id_list: for id in id_list:
relative_url = '/'.join([url,id]) relative_url = '/'.join([url,id])
object = p.unrestrictedTraverse(relative_url) object = p.unrestrictedTraverse(relative_url)
object_copy = object._getCopy(context) object_copy = object._getCopy(context)
include_sub_categories = object.getProperty('business_template_include_sub_categories', 0)
id_list = object_copy.objectIds() id_list = object_copy.objectIds()
if len(id_list) > 0 and include_sub_categories: if len(id_list) > 0:
self.build_sub_objects(context, id_list, relative_url) self.build_sub_objects(context, id_list, relative_url)
object_copy.manage_delObjects(list(id_list)) object_copy.manage_delObjects(list(id_list))
else:
object_copy.manage_delObjects(list(id_list))
if hasattr(object, '__ac_local_roles__'): if hasattr(object, '__ac_local_roles__'):
# remove local roles # remove local roles
object.__ac_local_roles__ = None object.__ac_local_roles__ = None
...@@ -661,8 +657,6 @@ class CategoryTemplateItem(ObjectTemplateItem): ...@@ -661,8 +657,6 @@ class CategoryTemplateItem(ObjectTemplateItem):
object_copy.uid = None object_copy.uid = None
self._objects[relative_url] = object_copy self._objects[relative_url] = object_copy
object.wl_clearLocks() object.wl_clearLocks()
return sub_list
def build(self, context, **kw): def build(self, context, **kw):
BaseTemplateItem.build(self, context, **kw) BaseTemplateItem.build(self, context, **kw)
...@@ -687,7 +681,6 @@ class CategoryTemplateItem(ObjectTemplateItem): ...@@ -687,7 +681,6 @@ class CategoryTemplateItem(ObjectTemplateItem):
self._objects[relative_url] = object_copy self._objects[relative_url] = object_copy
object.wl_clearLocks() object.wl_clearLocks()
def install(self, context, light_install = 0, **kw): def install(self, context, light_install = 0, **kw):
if (getattr(self, 'template_format_version', 0)) == 1: if (getattr(self, 'template_format_version', 0)) == 1:
if light_install==0: if light_install==0:
......
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