replace in the warning key the use of id by origin or id for the record

This commit refs #26162
This commit is contained in:
msanchez 2023-07-20 11:23:30 +02:00 committed by jm.pardo
parent e482b4f13c
commit e1f2867f8a
4 changed files with 8 additions and 6 deletions

View File

@ -483,7 +483,8 @@ class LoadOrder(metaclass=PoolMeta):
ul_quantity=int(record.ul_quantity))
if in_group():
warning_name = 'pending_uls_%s' % record.id
warning_name = 'pending_uls_%s' % (record.origins
or record.id)
if Warning.check(warning_name):
raise UserWarning(warning_name, message)
else:
@ -497,7 +498,8 @@ class LoadOrder(metaclass=PoolMeta):
loaded_cases=record.loaded_cases,
cases_quantity=record.cases_quantity)
if in_group():
warning_name = 'pending_cases_%s' % record.id
warning_name = 'pending_cases_%s' % (record.origins
or record.id)
if Warning.check(warning_name):
raise UserWarning(warning_name, message)
else:

View File

@ -352,13 +352,13 @@ Finish loading::
...
trytond.exceptions.UserWarning: You have loaded less ULs (3) than expected (4). -
>>> Model.get('res.user.warning')(user=config.user,
... name='pending_uls_1', always=True).save()
... name='pending_uls_%s' % load_order.origins, always=True).save()
>>> start_load.execute('pre_do')
Traceback (most recent call last):
...
trytond.exceptions.UserWarning: You have loaded less Cases (15.0) than expected (20.0). -
>>> Model.get('res.user.warning')(user=config.user,
... name='pending_cases_1', always=True).save()
... name='pending_cases_%s' % load_order.origins, always=True).save()
>>> start_load.execute('pre_do')
>>> load_order.reload()
>>> len(load_order.unit_loads)

View File

@ -315,7 +315,7 @@ Add an invalid UL::
>>> start_load.execute('load_')
Traceback (most recent call last):
...
trytond.modules.carrier_load_ul.exceptions.AddUnitLoadOverloadError: All valid lines of load order "1" are complete. Cannot load more ULs. -
trytond.modules.carrier_load_ul.exceptions.AddUnitLoadOverloadError: All valid lines for UL "2" in load order "1" are complete. -
Unload UL::

View File

@ -295,7 +295,7 @@ Add an invalid UL::
>>> start_load.execute('load_')
Traceback (most recent call last):
...
trytond.modules.carrier_load_ul.exceptions.AddUnitLoadOverloadError: All valid lines of load order "1" are complete. Cannot load more ULs. -
trytond.modules.carrier_load_ul.exceptions.AddUnitLoadOverloadError: All valid lines for UL "2" in load order "1" are complete. -
Unload UL::