diff --git a/lemarche/siaes/migrations/0072_siae_extra_data.py b/lemarche/siaes/migrations/0072_siae_extra_data.py new file mode 100644 index 000000000..e6d94a021 --- /dev/null +++ b/lemarche/siaes/migrations/0072_siae_extra_data.py @@ -0,0 +1,17 @@ +# Generated by Django 4.2.9 on 2024-02-26 15:03 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("siaes", "0071_alter_siae_kind"), + ] + + operations = [ + migrations.AddField( + model_name="siae", + name="extra_data", + field=models.JSONField(default=dict, editable=False, verbose_name="Données complémentaires"), + ), + ] diff --git a/lemarche/siaes/models.py b/lemarche/siaes/models.py index d6ea649a1..1c58d72de 100644 --- a/lemarche/siaes/models.py +++ b/lemarche/siaes/models.py @@ -853,6 +853,7 @@ class Siae(models.Model): source = models.CharField( max_length=20, choices=siae_constants.SOURCE_CHOICES, default=siae_constants.SOURCE_STAFF_C4_CREATED ) + extra_data = models.JSONField(verbose_name="Données complémentaires", editable=False, default=dict) import_raw_object = models.JSONField(verbose_name="Donnée JSON brute", editable=False, null=True) created_at = models.DateTimeField(verbose_name="Date de création", default=timezone.now) @@ -1234,6 +1235,11 @@ def get_absolute_url(self): def get_admin_url(self): return get_object_admin_url(self) + def set_brevo_id(self, brevo_company_id, with_save=True): + self.extra_data.update({"brevo_company_id": brevo_company_id}) + if with_save: + self.save() + def set_super_badge(self): update_fields_list = ["super_badge"] siae_super_badge_current_value = self.super_badge