Add method to format warning name with records

issue10507
review346471002
This commit is contained in:
Cédric Krier
2021-06-17 09:25:40 +02:00
parent 367ee7cb76
commit be44edbd60
+1 -3
View File
@@ -1,6 +1,5 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
import hashlib
from itertools import groupby
from trytond.i18n import gettext
@@ -234,8 +233,7 @@ class Production(metaclass=PoolMeta):
names = ', '.join(p.rec_name for p in productions[:5])
if len(pendings) > 5:
names += '...'
warning_name = '%s.pending_purchase.done' % hashlib.md5(
str(pendings).encode('utf-8')).hexdigest()
warning_name = Warning.format('pending_purchase.done', pendings)
if Warning.check(warning_name):
raise PurchaseWarning(
warning_name,