From 14ed8080299168c40338b091eb52314c19eaeabb Mon Sep 17 00:00:00 2001
From: benjamin <benjamin@le-filament.com>
Date: Thu, 16 Feb 2023 10:13:42 +0100
Subject: [PATCH] [update] date refund

---
 models/scop_cotisation_cg_exo.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/models/scop_cotisation_cg_exo.py b/models/scop_cotisation_cg_exo.py
index dfd9fb0..fd68a4f 100644
--- a/models/scop_cotisation_cg_exo.py
+++ b/models/scop_cotisation_cg_exo.py
@@ -492,9 +492,11 @@ class ScopCotisationExo(models.Model):
                     )
 
                 if exo_amount != 0:
-                    date_refund = (
-                        self.date_exo_ok
-                    )
+                    if self.date_exo_ok > bordereau_id.date_cotisation:
+                        date_refund = self.date_exo_ok
+                    else:
+                        date_refund = bordereau_id.date_cotisation
+
                     quarter_date_due = bordereau_id.invoice_ids.filtered(
                         lambda i: i.cotiz_quarter == str(quarter)
                         and i.move_type == "out_invoice"
-- 
GitLab