Commit c2987980 authored by Ayush Tiwari's avatar Ayush Tiwari

bt5_config: Update bootstrap_bm to use Business Manager for bootstrapping...

bt5_config: Update bootstrap_bm to use Business Manager for bootstrapping portal_types and portal_properties
parent 29aed26b
...@@ -1952,17 +1952,22 @@ class ERP5Generator(PortalGenerator): ...@@ -1952,17 +1952,22 @@ class ERP5Generator(PortalGenerator):
return p return p
@classmethod @classmethod
def bootstrap_bm(cls, portal, bm_name, path_list): def bootstrap_bm(cls, context, bm_name, path_list):
""" """
Bootstrap Business Item from the paths needed Bootstrap Business Item from the paths needed
""" """
bm_path = getBootstrapBusinessTemplateUrl(bm_name) bm_path = getBootstrapBusinessTemplateUrl(bm_name)
template_tool = portal.portal_templates portal = context.getPortalObject()
manager = template_tool.newContent(portal_type='Business Manager') try:
manager.importFile(bm_path + '/' + bm_name + '.zexp') # If template_tool doesn't exist, do nothing
for path in path_list: template_tool = portal.portal_templates
item = manager.getBusinessItemByPath(path) manager = template_tool.newContent(portal_type='Business Manager')
item.install(manager) manager.importFile(bm_path + '/' + bm_name + '.zexp')
for path in path_list:
item = manager.getBusinessItemByPath(path)
item.install(manager)
except AttributeError:
pass
@classmethod @classmethod
def bootstrap(cls, context, bt_name, item_name, content_id_list): def bootstrap(cls, context, bt_name, item_name, content_id_list):
...@@ -2333,6 +2338,12 @@ class ERP5Generator(PortalGenerator): ...@@ -2333,6 +2338,12 @@ class ERP5Generator(PortalGenerator):
if not p.hasObject('content_type_registry'): if not p.hasObject('content_type_registry'):
self.setupMimetypes(p) self.setupMimetypes(p)
# Explicitly run bootstrap for portal_types and portal_property_sheets
# before installing bootstrap Business Template/Manager becuase it needs to
# be there for bootstrap portal_types and property_sheets to be used.
p.portal_types._bootstrap()
p.portal_property_sheets._bootstrap()
if not update: if not update:
self.setupWorkflow(p) self.setupWorkflow(p)
self.setupERP5Core(p,**kw) self.setupERP5Core(p,**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