diff --git a/models/scop_cotisation_cg_exo.py b/models/scop_cotisation_cg_exo.py index a6465b36e2a9b118f3b8a62508bbc0b4375a21c4..5600d9f64dec57119e970172657f061e36324734 100644 --- a/models/scop_cotisation_cg_exo.py +++ b/models/scop_cotisation_cg_exo.py @@ -390,9 +390,10 @@ class ScopCotisationExo(models.Model): 'account_id': inv_id.account_id.id, 'payment_mode_id': bordereau_id.payment_mode_id.id, 'date_invoice': self.date_exo_ok, - 'date_due': bdx_quarters[quarter - 1], + 'date_due': self.date_exo_ok, 'bordereau_id': bordereau_id.id, 'cotiz_quarter': quarter, + 'refund_invoice_id': inv_id.id }) member_refund.invoice_line_ids.create({ 'invoice_id': member_refund.id, @@ -401,4 +402,17 @@ class ScopCotisationExo(models.Model): 'name': inv_id.invoice_line_ids[0].product_id.name + " T" + str(quarter), 'price_unit': exo_amount }) - self.update({'bordereau_ids': [(4, bordereau_id.id)]}) + # 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, + })