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

[fix] create version bordereau at the beginning of exo process

parent 3a47d253
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -354,7 +354,25 @@ class ScopCotisationExo(models.Model):
return quarters
def create_exo_refund(self, bordereau_id):
"""
- Create version before any change
- Create needed refund
"""
bordereau_id.ensure_one()
# Create version
if bordereau_id.state != 'new':
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,
})
exo_quarters = self.get_quarters()
# check exo period
exo_period = exo_quarters[bordereau_id.year]
......@@ -418,16 +436,3 @@ class ScopCotisationExo(models.Model):
})
# Update link exo - bordereau
self.update({'bordereau_ids': [(4, bordereau_id.id)]})
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,
})
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