From f2516a2e7393a74a6f790f70df2fddbdc4673de2 Mon Sep 17 00:00:00 2001 From: sofiagvaladze Date: Fri, 17 Nov 2023 10:47:15 +0100 Subject: [PATCH] [FIX] hr_holidays: allow message _subscribe to work in batch In case more that one leave record in passed to message _subscribe in will throw "Expected singleton" ValueError. This commit fixed the issue. Part-of: odoo/odoo#142327 --- addons/hr_holidays/models/hr_leave.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_holidays/models/hr_leave.py b/addons/hr_holidays/models/hr_leave.py index a5c3fe9674f..48c17ca7c49 100644 --- a/addons/hr_holidays/models/hr_leave.py +++ b/addons/hr_holidays/models/hr_leave.py @@ -1596,7 +1596,7 @@ Attempting to double-book your time off won't magically make your vacation 2x be def message_subscribe(self, partner_ids=None, subtype_ids=None): # due to record rule can not allow to add follower and mention on validated leave so subscribe through sudo - if self.state in ['validate', 'validate1']: + if any(holiday.state in ['validate', 'validate1'] for holiday in self): self.check_access_rights('read') self.check_access_rule('read') return super(HolidaysRequest, self.sudo()).message_subscribe(partner_ids=partner_ids, subtype_ids=subtype_ids)