From 261f5acd9e848dead4b00b01c45a5d5a5fcae515 Mon Sep 17 00:00:00 2001
From: Yvon Kerdoncuff <yvon@ik.me>
Date: Wed, 22 Jan 2025 15:45:43 +0100
Subject: [PATCH] use list instead of one id as there may be several shift_templates associated to one res_partner

---
 members/models.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/members/models.py b/members/models.py
index ebe1e23..e9e39f1 100644
--- a/members/models.py
+++ b/members/models.py
@@ -1088,17 +1088,17 @@ class CagetteMember(models.Model):
         return makeup_reg_ids
 
 
-    def get_shift_template_registration_id(self):
-        c = [['partner_id', '=', self.id], ['active', '=', True]]
+    def get_shift_template_registration_ids(self):
+        c = [['partner_id', '=', self.id]]
         f = ['id']
-        return self.o_api.search_read("shift.template.registration", c, f)[0]['id']
+        return self.o_api.search_read("shift.template.registration", c, f)
 
 
     def unsubscribe_member_but_exogenous_makeups(self):
         return self.o_api.execute(
             'shift.template.registration',
             'unlink_but_exogenous_makeups',
-            [self.get_shift_template_registration_id()]
+            [self.get_shift_template_registration_ids()]
         )
 
 
@@ -1106,7 +1106,7 @@ class CagetteMember(models.Model):
         return self.o_api.execute(
             'shift.template.registration',
             'unlink',
-            [self.get_shift_template_registration_id()]
+            [self.get_shift_template_registration_ids()]
         )
 
 
--
libgit2 0.26.0