From f1fbd7abb3519dbae58631d530bf66b679f6d16b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 16 Dec 2025 17:28:32 +0100 Subject: [PATCH] Allow filtering users to be notified by cron tasks Closes #14432 --- trytond/CHANGELOG | 1 + trytond/trytond/ir/cron.py | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/trytond/CHANGELOG b/trytond/CHANGELOG index 1a9c9bf837..20555e072a 100644 --- a/trytond/CHANGELOG +++ b/trytond/CHANGELOG @@ -1,3 +1,4 @@ +* Allow filtering users to be notified by cron tasks Version 7.8.0 - 2025-12-15 -------------------------- diff --git a/trytond/trytond/ir/cron.py b/trytond/trytond/ir/cron.py index 6a2fd4c48c..763fb1455f 100644 --- a/trytond/trytond/ir/cron.py +++ b/trytond/trytond/ir/cron.py @@ -312,7 +312,7 @@ class Cron(DeactivableMixin, ModelSQL, ModelView): @classmethod def notify( cls, icon, action_id, action_value, - message_id, n=None, **variables): + message_id, n=None, user_domain=None, **variables): "Notify subscribed users to the current cron task" pool = Pool() User = pool.get('res.user') @@ -325,9 +325,12 @@ class Cron(DeactivableMixin, ModelSQL, ModelView): action_id = ModelData.get_id(action_id) if action_value is not None and not isinstance(action_value, str): action_value = json.dumps(action_value) - users = User.search([ - ('notifications', 'in', method), - ]) + domain = [ + ('notifications', 'in', method), + ] + if user_domain is not None: + domain.append(user_domain) + users = User.search(domain) for language, users in groupby( users, key=lambda u: u.language): language = language.code if language else None