changeset d51b441543ac in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset&node=d51b441543ac
description:
        Add method to format warning name with records

        issue10507
        review346471002
diffstat:

 CHANGELOG           |  1 +
 trytond/res/user.py |  5 +++++
 2 files changed, 6 insertions(+), 0 deletions(-)

diffs (23 lines):

diff -r 5e42f723f5e5 -r d51b441543ac CHANGELOG
--- a/CHANGELOG Thu Jun 17 09:22:32 2021 +0200
+++ b/CHANGELOG Thu Jun 17 09:25:40 2021 +0200
@@ -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 -r 5e42f723f5e5 -r d51b441543ac trytond/res/user.py
--- a/trytond/res/user.py       Thu Jun 17 09:22:32 2021 +0200
+++ b/trytond/res/user.py       Thu Jun 17 09:25:40 2021 +0200
@@ -1012,6 +1012,11 @@
     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()
         user = transaction.user

Reply via email to