Catch errors of UserError class and append it to the errors log.

This commit is contained in:
Carlos G?lvez 2019-11-24 21:37:55 +01:00
parent f7ff36187e
commit 1c57e40753
1 changed files with 7 additions and 1 deletions

View File

@ -12,6 +12,7 @@ from trytond.modules.edocument_unedifact.edocument import (Message, Serializer)
from trytond.modules.edocument_unedifact.edocument import (with_segment_check,
separate_section, RewindIterator, DO_NOTHING, NO_ERRORS)
from datetime import datetime
from trytond.exceptions import UserError
__all__ = ['Move', 'StockConfiguration', 'ShipmentIn', 'Cron']
@ -206,7 +207,12 @@ class ShipmentIn(EdifactMixin, metaclass=PoolMeta):
to_save.append(move)
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
@classmethod