mirror of
https://gitlab.com/datalifeit/trytond-stock_shipment_in_edi
synced 2023-12-14 06:42:59 +01:00
Catch errors of UserError class and append it to the errors log.
This commit is contained in:
parent
f7ff36187e
commit
1c57e40753
|
@ -12,6 +12,7 @@ from trytond.modules.edocument_unedifact.edocument import (Message, Serializer)
|
||||||
from trytond.modules.edocument_unedifact.edocument import (with_segment_check,
|
from trytond.modules.edocument_unedifact.edocument import (with_segment_check,
|
||||||
separate_section, RewindIterator, DO_NOTHING, NO_ERRORS)
|
separate_section, RewindIterator, DO_NOTHING, NO_ERRORS)
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from trytond.exceptions import UserError
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['Move', 'StockConfiguration', 'ShipmentIn', 'Cron']
|
__all__ = ['Move', 'StockConfiguration', 'ShipmentIn', 'Cron']
|
||||||
|
@ -206,7 +207,12 @@ class ShipmentIn(EdifactMixin, metaclass=PoolMeta):
|
||||||
to_save.append(move)
|
to_save.append(move)
|
||||||
|
|
||||||
if to_save:
|
if to_save:
|
||||||
Move.save(to_save)
|
try:
|
||||||
|
Move.save(to_save)
|
||||||
|
except UserError as e:
|
||||||
|
total_errors.append(e.message)
|
||||||
|
return None, total_errors
|
||||||
|
|
||||||
return shipment, total_errors
|
return shipment, total_errors
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
Loading…
Reference in a new issue