Commit 229e953a authored by Xiaowu Zhang's avatar Xiaowu Zhang Committed by Cédric Le Ninivin

OrganisationConfiguratorItem: get organisation id from user input

parent 75b6fc6a
......@@ -61,29 +61,28 @@ class OrganisationConfiguratorItem(ConfiguratorItemMixin, XMLObject):
""" Setup organisation. """
if fixit:
portal = self.getPortalObject()
organisation = portal.organisation_module.newContent(portal_type="Organisation")
organisation = portal.organisation_module[self.getId()]
if organisation is not None:
org_dict = {'price_currency': 'currency_module/%s' % self.getPriceCurrency(),
'group': self.getGroup(),
'title': self.getTitle(),
'corporate_name': self.getCorporateName(),
'default_address_city': self.getDefaultAddressCity(),
'default_email_text': self.getDefaultEmailText(),
'default_telephone_text': self.getDefaultTelephoneText(),
'default_address_zip_code': self.getDefaultAddressZipCode(),
'default_address_region': self.getDefaultAddressRegion(),
'default_address_street_address': self.getDefaultAddressStreetAddress(),
}
organisation.edit(**org_dict)
org_dict = {'price_currency': 'currency_module/%s' % self.getPriceCurrency(),
'group': self.getGroup(),
'title': self.getTitle(),
'corporate_name': self.getCorporateName(),
'default_address_city': self.getDefaultAddressCity(),
'default_email_text': self.getDefaultEmailText(),
'default_telephone_text': self.getDefaultTelephoneText(),
'default_address_zip_code': self.getDefaultAddressZipCode(),
'default_address_region': self.getDefaultAddressRegion(),
'default_address_street_address': self.getDefaultAddressStreetAddress(),
'site':'main', # First customer's organisation is always main site.
}
organisation.edit(**org_dict)
business_configuration = self.getBusinessConfigurationValue()
# store globally organization_id
business_configuration.setGlobalConfigurationAttr(organisation_id=organisation.getId())
business_configuration = self.getBusinessConfigurationValue()
# store globally organization_id
business_configuration.setGlobalConfigurationAttr(organisation_id=organisation.getId())
if self.portal_workflow.isTransitionPossible(organisation, 'validate'):
organisation.validate(comment=translateString("Validated by Configurator"))
if self.portal_workflow.isTransitionPossible(organisation, 'validate'):
organisation.validate(comment=translateString("Validated by Configurator"))
## add to customer template
self.install(organisation, business_configuration)
## add to customer template
self.install(organisation, business_configuration)
return [self._createConstraintMessage('Organisation should be created')]
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