details: https://code.tryton.org/tryton/commit/3bf708d24994
branch: default
user: Cédric Krier <[email protected]>
date: Fri Mar 20 18:42:55 2026 +0100
description:
Publish a message when notifications are silenced
#14698
diffstat:
trytond/trytond/res/message.xml | 4 ++++
trytond/trytond/res/notification.py | 10 ++++++++++
2 files changed, 14 insertions(+), 0 deletions(-)
diffs (47 lines):
diff -r cf3d190fe89d -r 3bf708d24994 trytond/trytond/res/message.xml
--- a/trytond/trytond/res/message.xml Fri Mar 20 18:41:23 2026 +0100
+++ b/trytond/trytond/res/message.xml Fri Mar 20 18:42:55 2026 +0100
@@ -28,5 +28,9 @@
<record model="ir.message" id="msg_user_password">
<field name="text">Password for %(login)s</field>
</record>
+ <record model="ir.message" id="msg_notification_silenced">
+ <field name="text">%(number)s notification silenced.</field>
+ <field name="text_plural">%(number)s notifications
silenced.</field>
+ </record>
</data>
</tryton>
diff -r cf3d190fe89d -r 3bf708d24994 trytond/trytond/res/notification.py
--- a/trytond/trytond/res/notification.py Fri Mar 20 18:41:23 2026 +0100
+++ b/trytond/trytond/res/notification.py Fri Mar 20 18:42:55 2026 +0100
@@ -9,6 +9,7 @@
from sql.aggregate import Count
from trytond.bus import Bus
+from trytond.i18n import ngettext
from trytond.ir.ui.menu import CLIENT_ICONS
from trytond.model import Index, ModelSQL, ModelView, fields
from trytond.pool import Pool
@@ -82,6 +83,10 @@
@classmethod
def create(cls, vlist):
+ pool = Pool()
+ Lang = pool.get('ir.lang')
+ lang = Lang.get()
+
notifications = super().create(vlist)
notifications_by_user = defaultdict(list)
@@ -102,6 +107,11 @@
messages = [
'\n'.join(map(shorten, filter(None, (n.label, n.description))))
for n in user_notifications[:4]]
+ if len(user_notifications) > 4:
+ n = len(user_notifications) - 4
+ messages.append(ngettext(
+ 'res.msg_notification_silenced', n,
+ number=lang.format_number(n)))
Bus.publish(
f'notification:{user}', {
'type': 'user-notification',