From b8204de75d2096420e24bdf3ccdc46019bcb550f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miquel=20Ra=C3=AFch?= Date: Thu, 22 Aug 2024 17:17:42 +0200 Subject: [PATCH] [FIX] edi_oca: improve error in order to be helpful --- edi_oca/models/edi_backend.py | 3 ++- edi_oca/tests/test_backend_input.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/edi_oca/models/edi_backend.py b/edi_oca/models/edi_backend.py index 24f35f320f..d688e95e08 100644 --- a/edi_oca/models/edi_backend.py +++ b/edi_oca/models/edi_backend.py @@ -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") diff --git a/edi_oca/tests/test_backend_input.py b/edi_oca/tests/test_backend_input.py index 456682068a..138ae3fcc4 100644 --- a/edi_oca/tests/test_backend_input.py +++ b/edi_oca/tests/test_backend_input.py @@ -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(