(organizations) add siret to name conversion

This adds the plugin system to easily manage
Organization related customizations. This first
plugin tries (best effort) to get a proper name
for the Organization, using its SIRET. This
is French specificities but another plugin can
be defined for other cases.
This commit is contained in:
Quentin BEY
2024-12-05 18:19:11 +01:00
committed by BEY Quentin
parent 6e14c2e61f
commit 38a5f158b5
11 changed files with 277 additions and 0 deletions

View File

@@ -29,6 +29,7 @@ import jsonschema
from timezone_field import TimeZoneField
from core.enums import WebhookStatusChoices
from core.plugins.loader import organization_plugins_run_after_create
from core.utils.webhooks import scim_synchronizer
from core.validators import get_field_validators_from_setting
@@ -286,6 +287,16 @@ class OrganizationManager(models.Manager):
raise ValueError("Should never reach this point.")
def create(self, **kwargs):
"""
Create an organization with the given kwargs.
This method is overridden to call the Organization plugins.
"""
instance = super().create(**kwargs)
organization_plugins_run_after_create(instance)
return instance
class Organization(BaseModel):
"""