Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions edi_core_oca/models/edi_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ def exchange_generate(self, exchange_record, store=True, force=False, **kw):
if output:
message = exchange_record._exchange_status_message("generate_ok")
try:
self._validate_data(exchange_record, output)
with self.env.cr.savepoint():
self._validate_data(exchange_record, output)
except EDIValidationError as err:
traceback = _get_exception_traceback()
error = _get_exception_msg(err)
Expand Down Expand Up @@ -240,8 +241,9 @@ def exchange_send(self, exchange_record):
message = None
res = ""
try:
self._exchange_send(exchange_record)
_logger.debug("%s sent", exchange_record.identifier)
with self.env.cr.savepoint():
self._exchange_send(exchange_record)
_logger.debug("%s sent", exchange_record.identifier)
except self._send_retryable_exceptions() as err:
traceback = _get_exception_traceback()
error = _get_exception_msg(err)
Expand Down Expand Up @@ -469,7 +471,8 @@ def exchange_process(self, exchange_record):
message = None
res = None
try:
res = self._exchange_process(exchange_record)
with self.env.cr.savepoint():
res = self._exchange_process(exchange_record)
except self._swallable_exceptions() as err:
if self.env.context.get("_edi_process_break_on_error"):
raise
Expand Down Expand Up @@ -526,11 +529,12 @@ def exchange_receive(self, exchange_record):
message = None
res = None
try:
content = self._exchange_receive(exchange_record)
# Ignore result of FileNotFoundError/OSError
if content is not None:
exchange_record._set_file_content(content)
self._validate_data(exchange_record)
with self.env.cr.savepoint():
content = self._exchange_receive(exchange_record)
# Ignore result of FileNotFoundError/OSError
if content is not None:
exchange_record._set_file_content(content)
self._validate_data(exchange_record)
except EDIValidationError as err:
traceback = _get_exception_traceback()
error = _get_exception_msg(err)
Expand Down
1 change: 1 addition & 0 deletions edi_core_oca/tests/fake_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class EdiExchangeConsumerTest(models.Model):
_description = "Model used only for test"

name = fields.Char()
ref = fields.Char()
edi_config_ids = fields.Many2many(
string="EDI Test Config Ids",
comodel_name="edi.configuration",
Expand Down
Loading