From f6e320efd1a7e4ebc4e078d9f36b9d4a2e3e82f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 17 Jun 2021 09:25:40 +0200 Subject: [PATCH] Add method to format warning name with records issue10507 review346471002 --- CHANGELOG | 1 + trytond/res/user.py | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 8c889ba8f7..d71d5a06bd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Add method to format warning name with records * Add option to trytond-console to start a readonly transaction * Add support for werkzeug 2.0 * Combine search and get_keys in DictSchemaMixin diff --git a/trytond/res/user.py b/trytond/res/user.py index 4f7f7fd3ea..c2fdde2892 100644 --- a/trytond/res/user.py +++ b/trytond/res/user.py @@ -1011,6 +1011,11 @@ class Warning_(ModelSQL, ModelView): name = fields.Char('Name', required=True, select=True) always = fields.Boolean('Always') + @classmethod + def format(cls, name, records): + return '%s.%s' % ( + hashlib.md5(str(records).encode('utf-8')).hexdigest(), name) + @classmethod def check(cls, warning_name): transaction = Transaction()