From 3a47d253c3613650ce55b8363f6cf7fe15e10178 Mon Sep 17 00:00:00 2001 From: benjamin <benjamin@le-filament.com> Date: Tue, 22 Feb 2022 17:38:46 +0100 Subject: [PATCH] [update] date & name on refund --- models/scop_cotisation_cg_exo.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/models/scop_cotisation_cg_exo.py b/models/scop_cotisation_cg_exo.py index 04d8ad5..c309774 100644 --- a/models/scop_cotisation_cg_exo.py +++ b/models/scop_cotisation_cg_exo.py @@ -389,6 +389,7 @@ class ScopCotisationExo(models.Model): raise UserError("Erreur, le type d'exonération n'est pas configuré") if exo_amount != 0: + date_refund = bordereau_id.date_cotisation if bordereau_id.state == 'draft' else self.date_exo_ok # Create refund member_refund = bordereau_id.invoice_ids.create({ 'partner_id': bordereau_id.partner_id.id, @@ -401,11 +402,12 @@ class ScopCotisationExo(models.Model): 'state': 'draft', 'account_id': inv_id.account_id.id, 'payment_mode_id': bordereau_id.payment_mode_id.id, - 'date_invoice': self.date_exo_ok, + 'date_invoice': date_refund, 'date_due': self.date_exo_ok, 'bordereau_id': bordereau_id.id, 'cotiz_quarter': quarter, - 'refund_invoice_id': inv_id.id + 'refund_invoice_id': inv_id.id, + 'name': 'Exonération ' + self.number }) member_refund.invoice_line_ids.create({ 'invoice_id': member_refund.id, -- GitLab