Skip to content

Commit

Permalink
[FIX] edi_oca: improve error in order to be helpful
Browse files Browse the repository at this point in the history
  • Loading branch information
MiquelRForgeFlow committed Aug 22, 2024
1 parent bc5de07 commit b8204de
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion edi_oca/models/edi_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,8 @@ def _validate_data(self, exchange_record, value=None, **kw):
if exchange_record.direction == "input" and not exchange_record.exchange_file:
if not exchange_record.type_id.allow_empty_files_on_receive:
raise ValueError(
_("Empty files are not allowed for this exchange type")
_("Empty files are not allowed for exchange type %s (%s)" % (
exchange_record.type_id.name, exchange_record.type_id.code))
)

component = self._get_component(exchange_record, "validate")
Expand Down
2 changes: 1 addition & 1 deletion edi_oca/tests/test_backend_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def test_receive_no_allow_empty_file_record(self):
fake_output="", _edi_receive_break_on_error=False
).exchange_receive(self.record)
# Check the record
msg = "Empty files are not allowed for this exchange type"
msg = "Empty files are not allowed for exchange type"
self.assertIn(msg, self.record.exchange_error)
self.assertEqual(self.record._get_file_content(), "")
self.assertRecordValues(
Expand Down

0 comments on commit b8204de

Please sign in to comment.