Skip to content
Extraits de code Groupes Projets
Valider 9b558629 rédigé par jordan's avatar jordan
Parcourir les fichiers

[update] affect coop to direccte when valid_cg

parent e905c018
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -407,6 +407,19 @@ class ScopPartner(models.Model):
'context': ctx,
}
@api.multi
def affectation_direccte(self):
""" Affecte DIRECCTE thanks to zip_department
:return:
"""
organization_type_dirrecte = self.env.ref('cgscop_partner.riga_14562')
direccte_id = self.env['res.partner'].search([
('organization_subtype_id', '=', organization_type_dirrecte.id),
('zip_departement', '=', self.zip_departement)
])
if len(direccte_id) == 1:
self.direccte_id = direccte_id.id
# ------------------------------------------------------
# Override parent / Change of status
# ------------------------------------------------------
......@@ -440,6 +453,7 @@ class ScopPartner(models.Model):
def scop_valid_cg(self):
"""
Inherit function to :
- affect coop to DIRECCTE
- create period adhesion CG
- create period adhesion Fédé if needed
- create invoice adhesion
......@@ -447,6 +461,9 @@ class ScopPartner(models.Model):
"""
res = super(ScopPartner, self).scop_valid_cg()
# Affectation to DIRECCTE
self.affectation_direccte()
# Create period adhésions with num adherent
num_adherent = self.create_num_adherent()
self.create_period_adhesion_cg(num_adherent)
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter