From 2d7d2fac6d1306a5b02e0893fe3cee843afbca27 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Herv=C3=A9=20Silvant?= <hsilvant@scop.coop>
Date: Thu, 3 Jun 2021 12:40:56 +0200
Subject: [PATCH] =?UTF-8?q?Test=20si=20une=20date=20de=20radiation=20est?=
 =?UTF-8?q?=20pr=C3=A9sente=20avant=20de=20radier=20=C3=A0=20la=20date=20d?=
 =?UTF-8?q?u=20d=C3=A9c=C3=A8s?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 wizard/scop_deces_wizard.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/wizard/scop_deces_wizard.py b/wizard/scop_deces_wizard.py
index 35327c3..83ca0ca 100644
--- a/wizard/scop_deces_wizard.py
+++ b/wizard/scop_deces_wizard.py
@@ -76,10 +76,11 @@ class ScopDecesWizard(models.TransientModel):
                         [('partner_id', '=', period.partner_id),
                          ('end', '=', False)])
                     for adh in adh_period:
-                        adh.write({
-                            'end': period.end,
-                            'end_reason_id': motif.id
-                        })
+                        if(adh.end==False):
+                            adh.write({
+                                'end': period.end,
+                                'end_reason_id': motif.id
+                            })
 
             else:
                 raise ValidationError(
-- 
GitLab