Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][FIX] edi_oca: improve error in order to be helpful (forward port) #106

Merged
merged 1 commit into from
Oct 7, 2024
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
8 changes: 7 additions & 1 deletion edi_oca/models/edi_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,13 @@ 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 %(name)s (%(code)s)"
)
% {
"name": exchange_record.type_id.name,
"code": 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 @@ -50,7 +50,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
Loading