details:   https://code.tryton.org/tryton/commit/be0b050dd37d
branch:    default
user:      Cédric Krier <[email protected]>
date:      Tue Mar 24 18:25:19 2026 +0100
description:
        Do not use Literal to count in SQL

        Following ce972acc1cf2, this conversion was missing and prevent psycopg 
3 to
        determine the data type.
diffstat:

 trytond/trytond/res/notification.py |  3 +--
 trytond/trytond/tests/test_chat.py  |  1 +
 2 files changed, 2 insertions(+), 2 deletions(-)

diffs (31 lines):

diff -r 5bf24cd6c16a -r be0b050dd37d trytond/trytond/res/notification.py
--- a/trytond/trytond/res/notification.py       Tue Mar 24 09:30:17 2026 +0100
+++ b/trytond/trytond/res/notification.py       Tue Mar 24 18:25:19 2026 +0100
@@ -4,7 +4,6 @@
 import json
 from collections import defaultdict
 
-from sql import Literal
 from sql.aggregate import Count
 
 from trytond.bus import Bus
@@ -149,7 +148,7 @@
         notification = cls.__table__()
         cursor = Transaction().connection.cursor()
         cursor.execute(*notification.select(
-                Count(Literal('*')),
+                Count(),
                 where=((notification.user == Transaction().user)
                     & notification.unread)))
         return cursor.fetchone()[0]
diff -r 5bf24cd6c16a -r be0b050dd37d trytond/trytond/tests/test_chat.py
--- a/trytond/trytond/tests/test_chat.py        Tue Mar 24 09:30:17 2026 +0100
+++ b/trytond/trytond/tests/test_chat.py        Tue Mar 24 18:25:19 2026 +0100
@@ -49,6 +49,7 @@
         self.assertEqual(message.audience, 'public')
         self.assertEqual(message.content, "Chat Message: Bar")
         with Transaction().set_user(alice.id):
+            self.assertEqual(Notification.get_count(), 1)
             notification, = Notification.get()
             self.assertEqual(notification, {
                     'id': notification['id'],

Reply via email to