diff --git a/inventory.py b/inventory.py index 29f1f9ae67..d91b5aea2b 100644 --- a/inventory.py +++ b/inventory.py @@ -1,7 +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 sql import Null from trytond.i18n import gettext @@ -166,9 +164,7 @@ class Inventory(Workflow, ModelSQL, ModelView): names = ', '.join(i.rec_name for i in future_inventories[:5]) if len(future_inventories) > 5: names + '...' - warning_name = ( - '%s.date_future' % hashlib.md5( - str(future_inventories).encode('utf-8')).hexdigest()) + warning_name = Warning.format('date_future', future_inventories) if Warning.check(warning_name): raise InventoryFutureWarning(warning_name, gettext('stock.msg_inventory_date_in_the_future', diff --git a/move.py b/move.py index fa93cbd1fa..155e6d5d2f 100644 --- a/move.py +++ b/move.py @@ -1,7 +1,6 @@ # 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 datetime -import hashlib import operator from decimal import Decimal from collections import OrderedDict, defaultdict @@ -710,9 +709,8 @@ class Move(Workflow, ModelSQL, ModelView): names = ', '.join(m.rec_name for m in future_moves[:5]) if len(future_moves) > 5: names += '...' - warning_name = ( - '%s.effective_date_future' % hashlib.md5( - str(future_moves).encode('utf-8')).hexdigest()) + warning_name = Warning.format( + 'effective_date_future', future_moves) if Warning.check(warning_name): raise MoveFutureWarning(warning_name, gettext('stock.msg_move_effective_date_in_the_future', @@ -875,8 +873,7 @@ class Move(Workflow, ModelSQL, ModelView): names = ', '.join(m.rec_name for m in moves[:5]) if len(moves) > 5: names += '...' - warning_name = '%s.done' % hashlib.md5( - str(moves).encode('utf-8')).hexdigest() + warning_name = Warning.format('done', moves) if Warning.check(warning_name): raise MoveOriginWarning(warning_name, gettext('stock.msg_move_no_origin',