Skip to content
Extraits de code Groupes Projets
Valider 02427eb7 rédigé par Julien - Le Filament's avatar Julien - Le Filament
Parcourir les fichiers

[UPD] add first closeout

parent e7aa2cae
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -20,6 +20,11 @@ class ResPartner(models.Model): ...@@ -20,6 +20,11 @@ class ResPartner(models.Model):
inverse_name="partner_id", inverse_name="partner_id",
string="Dirigeants", string="Dirigeants",
) )
last_inpi_update_date = fields.Datetime(
string="Dernière mise à jours INPI",
tracking=True
)
first_company_closeout = fields.Date(string="Date de première cloture")
# -------------------------------------------------- # --------------------------------------------------
# Fonctions utiles traiement reponse INPI # Fonctions utiles traiement reponse INPI
...@@ -476,6 +481,22 @@ class ResPartner(models.Model): ...@@ -476,6 +481,22 @@ class ResPartner(models.Model):
else: else:
logger.info(_(f"No siege found for {self.name}: {self.siren}")) logger.info(_(f"No siege found for {self.name}: {self.siren}"))
# --------------------------------------------------
# date de premiere cloture
# --------------------------------------------------
def _update_companie_first_closeout(self, inpi_data):
"""
MAJ de la date de premiere cloture des comptes
"""
logger.info(_(f"Update company first closeout date for {self.name}: {self.siren}"))
if inpi_data.formality.content.personneMorale and inpi_data.formality.content.personneMorale.identite:
description = inpi_data.formality.content.personneMorale.identite.description
if description.datePremiereCloture:
self.first_company_closeout = description.datePremiereCloture
else:
logger.info(_(f"No company first closeout date found for {self.name}: {self.siren}"))
# -------------------------------------------------- # --------------------------------------------------
# UPDATE # UPDATE
# -------------------------------------------------- # --------------------------------------------------
...@@ -486,6 +507,7 @@ class ResPartner(models.Model): ...@@ -486,6 +507,7 @@ class ResPartner(models.Model):
Une periode est créee à la fin Une periode est créee à la fin
""" """
logger.info(_(f"Update all for {self.name}: {self.siren}")) logger.info(_(f"Update all for {self.name}: {self.siren}"))
self._update_companie_first_closeout(inpi_data=inpi_data)
self._update_denomination_from_inpi(inpi_data=inpi_data, new_period=False) self._update_denomination_from_inpi(inpi_data=inpi_data, new_period=False)
self._update_forme_juridique_from_inpi(inpi_data=inpi_data, new_period=False) self._update_forme_juridique_from_inpi(inpi_data=inpi_data, new_period=False)
self._update_naf_from_inpi(inpi_data=inpi_data, new_period=False) self._update_naf_from_inpi(inpi_data=inpi_data, new_period=False)
...@@ -498,3 +520,5 @@ class ResPartner(models.Model): ...@@ -498,3 +520,5 @@ class ResPartner(models.Model):
period.write({"end": datetime.datetime.now().date(), "end_reason": "inpi"}) period.write({"end": datetime.datetime.now().date(), "end_reason": "inpi"})
period_values = self._get_values_from_period(period) period_values = self._get_values_from_period(period)
self.env["scop.period"].with_context().create(period_values) self.env["scop.period"].with_context().create(period_values)
self.last_inpi_update_date = datetime.datetime.now()
...@@ -17,6 +17,10 @@ ...@@ -17,6 +17,10 @@
<field name="inpi_director_ids" /> <field name="inpi_director_ids" />
</page> </page>
</xpath> </xpath>
<xpath expr="//field[@name='closeout_month']" position="after">
<field name="first_company_closeout" />
<field name="last_inpi_update_date" />
</xpath>
</field> </field>
</record> </record>
</data> </data>
......
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