changeset 2655e00fde5a in modules/stock:default
details: https://hg.tryton.org/modules/stock?cmd=changeset&node=2655e00fde5a
description:
Add method to format warning name with records
issue10507
review346471002
diffstat:
inventory.py | 6 +-----
move.py | 9 +++------
2 files changed, 4 insertions(+), 11 deletions(-)
diffs (55 lines):
diff -r 86462ba82294 -r 2655e00fde5a inventory.py
--- a/inventory.py Fri Jun 11 08:36:26 2021 +0200
+++ b/inventory.py Thu Jun 17 09:25:40 2021 +0200
@@ -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 @@
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 -r 86462ba82294 -r 2655e00fde5a move.py
--- a/move.py Fri Jun 11 08:36:26 2021 +0200
+++ b/move.py Thu Jun 17 09:25:40 2021 +0200
@@ -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 @@
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 @@
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',