details: https://code.tryton.org/tryton/commit/a329bddd2e13
branch: default
user: Cédric Krier <[email protected]>
date: Tue Dec 16 17:28:32 2025 +0100
description:
Allow filtering users to be notified by cron tasks
Closes #14432
diffstat:
trytond/CHANGELOG | 1 +
trytond/trytond/ir/cron.py | 11 +++++++----
2 files changed, 8 insertions(+), 4 deletions(-)
diffs (36 lines):
diff -r 56f3503538ab -r a329bddd2e13 trytond/CHANGELOG
--- a/trytond/CHANGELOG Tue Dec 16 17:21:41 2025 +0100
+++ b/trytond/CHANGELOG Tue Dec 16 17:28:32 2025 +0100
@@ -1,3 +1,4 @@
+* Allow filtering users to be notified by cron tasks
Version 7.8.0 - 2025-12-15
--------------------------
diff -r 56f3503538ab -r a329bddd2e13 trytond/trytond/ir/cron.py
--- a/trytond/trytond/ir/cron.py Tue Dec 16 17:21:41 2025 +0100
+++ b/trytond/trytond/ir/cron.py Tue Dec 16 17:28:32 2025 +0100
@@ -312,7 +312,7 @@
@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 @@
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