Commit f82ee82f authored by Rafael Monnerat's avatar Rafael Monnerat

Improve code.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@45021 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7dff2316
...@@ -57,16 +57,11 @@ class ServiceConfiguratorItem(ConfiguratorItemMixin, XMLObject): ...@@ -57,16 +57,11 @@ class ServiceConfiguratorItem(ConfiguratorItemMixin, XMLObject):
def build(self, business_configuration): def build(self, business_configuration):
portal = self.getPortalObject() portal = self.getPortalObject()
module = portal.service_module
# XXX Maybe this approach efficient and scalable.
object_id_list = module.objectIds()
for service_id, service_title in self.getConfigurationList(): for service_id, service_title in self.getConfigurationList():
if service_id not in object_id_list: document = getattr(portal.service_module, service_id, None)
document = module.newContent(portal_type='Service', if document is None:
document = portal.service_module.newContent(portal_type='Service',
id=service_id, id=service_id,
title=service_title, title=service_title)
)
else:
document = module[service_id]
## add to customer template ## add to customer template
self.install(document, business_configuration) self.install(document, business_configuration)
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