[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
This commit is contained in:
sofiagvaladze
2023-12-28 09:40:08 +00:00
parent 7b95532d23
commit f2516a2e73
+1 -1
View File
@@ -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)