Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
|
0a9c0dd404 | 5 days ago |
|
f0e6593919 | 5 days ago |
5 changed files with 50 additions and 17 deletions
@ -1,3 +1,4 @@
@@ -1,3 +1,4 @@
|
||||
from .contact_builder import ContactModelBuilder # noqa |
||||
from .organisation_adhesion_append import OrganisationAdhesionAppend # noqa |
||||
from .organisation_builder import OrganisationModelBuilder # noqa |
||||
from .relation_builder import RelationModelBuilder # noqa |
||||
|
@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
|
||||
# -*- coding: utf-8 -*- |
||||
import logging |
||||
|
||||
from creme.persons import get_contact_model, get_organisation_model |
||||
|
||||
logger = logging.getLogger(__name__) |
||||
|
||||
|
||||
class OrganisationAdhesionAppend: |
||||
model = get_organisation_model() |
||||
model_contact = get_contact_model() |
||||
|
||||
def __init__(self, obj_in, dryrun=True): |
||||
self.obj_in = obj_in |
||||
self.dryrun = dryrun |
||||
|
||||
def process(self): |
||||
self.orga = self.model.objects.get(import_id=self.obj_in.id) |
||||
self.contact_id = self.model_contact.objects.get( |
||||
import_id=self.obj_in.contact_adhesion.id |
||||
).id |
||||
self.orga.contact_adherent_id = self.contact_id |
||||
if not self.dryrun: |
||||
self.orga.save() |
||||
return self |
Loading…
Reference in new issue