✨(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:
@@ -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):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user