diff --git a/models/scop_cotisation_cg_exo.py b/models/scop_cotisation_cg_exo.py index 5600d9f64dec57119e970172657f061e36324734..399d5849baf0636f77fec1f925d91545c8397e46 100644 --- a/models/scop_cotisation_cg_exo.py +++ b/models/scop_cotisation_cg_exo.py @@ -405,14 +405,15 @@ class ScopCotisationExo(models.Model): # Update link exo - bordereau self.update({'bordereau_ids': [(4, bordereau_id.id)]}) - # Create version - self.env['scop.bordereau.version'].create({ - 'bordereau_id': bordereau_id.id, - 'date': self.date_exo_ok, - 'comment': "Exonération", - 'version': bordereau_id.version, - 'liasse_fiscale_id_old': bordereau_id.liasse_fiscale_id.id, - 'type_assiette': bordereau_id.type_assiette, - 'montant_assiette': bordereau_id.montant_assiette, - 'amount_total_cotiz': bordereau_id.amount_total_cotiz, - }) + if bordereau_id.state != 'new': + # Create version + self.env['scop.bordereau.version'].create({ + 'bordereau_id': bordereau_id.id, + 'date': self.date_exo_ok, + 'comment': "Exonération", + 'version': bordereau_id.version, + 'liasse_fiscale_id_old': bordereau_id.liasse_fiscale_id.id, + 'type_assiette': bordereau_id.type_assiette, + 'montant_assiette': bordereau_id.montant_assiette, + 'amount_total_cotiz': bordereau_id.amount_total_cotiz, + })