Commit 1a4b40b8 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_erp5: Only set SITE prefix if organisation has a specific role

parent b2eda41f
......@@ -4,13 +4,19 @@ portal = context.getPortalObject()
if organisation.getValidationState() != "draft":
return
if organisation.getRole() != "host":
role = organisation.getRole()
if role not in ["host", "client"]:
return
if role == "host":
reference_prefix = "SITE"
else:
reference_prefix = "O"
if organisation.getReference() in [None, ""]:
reference = "SITE-%s" % portal.portal_ids.generateNewId(
reference = "%s-%s" % (reference_prefix, portal.portal_ids.generateNewId(
id_group='slap_organisation_reference',
id_generator='uid')
id_generator='uid'))
organisation.setReference(reference)
......
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