From d86d1f5854aac4f0fabd05f4ca3176de64757846 Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Mon, 25 May 2026 10:08:30 +0200 Subject: [PATCH 1/2] [COV] edi_core_oca: add test cov for conf lookup Ensure the conf and the env on the record is loaded properly when the handler is initialized. --- edi_core_oca/tests/test_backend_base.py | 66 +++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/edi_core_oca/tests/test_backend_base.py b/edi_core_oca/tests/test_backend_base.py index bb4bb322a..ab30fb873 100644 --- a/edi_core_oca/tests/test_backend_base.py +++ b/edi_core_oca/tests/test_backend_base.py @@ -11,6 +11,14 @@ class EDIBackendTestCaseBase(EDIBackendCommonTestCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.default_record = cls.backend.create_record( + "test_csv_input", + {"model": cls.partner._name, "res_id": cls.partner.id}, + ) + def setUp(self): super().setUp() self.loader = FakeModelLoader(self.env, self.__module__) @@ -92,3 +100,61 @@ def test_get_handler_no_handler(self): for action in ["receive", "input_validate", "process"]: with self.assertRaises(EDINotImplementedError): self.backend._get_exec_handler(record, action) + + # ---- conf / env_ctx resolution ------------------------------------------ + + def test_get_conf_for_record(self): + """`_get_conf_for_record` returns the action conf, or {} when missing.""" + self.exchange_type_in.advanced_settings_edit = ( + "execution_model:\n" + " receive:\n" + " env_ctx:\n" + " foo: bar\n" + " other_key: 1\n" + ) + record = self.default_record + # Action declared -> its conf + self.assertEqual( + self.backend._get_conf_for_record(record, "receive"), + {"env_ctx": {"foo": "bar"}, "other_key": 1}, + ) + # Action not declared -> empty + self.assertEqual(self.backend._get_conf_for_record(record, "process"), {}) + + def test_get_record_env_ctx(self): + """`_get_record_env_ctx` returns env_ctx for the action, else {}.""" + self.exchange_type_in.advanced_settings_edit = ( + "execution_model:\n" + " receive:\n" + " env_ctx:\n" + " foo: bar\n" + " flag: true\n" + " process:\n" + " other_key: 1\n" + ) + record = self.default_record + # Action with env_ctx -> mapping + self.assertEqual( + self.backend._get_record_env_ctx(record, "receive"), + {"foo": "bar", "flag": True}, + ) + # Action present but no env_ctx -> empty + self.assertEqual(self.backend._get_record_env_ctx(record, "process"), {}) + + def test_get_exec_handler_propagates_env_ctx(self): + """The handler returned by `_get_exec_handler` carries env_ctx keys.""" + self.exchange_type_in.advanced_settings_edit = ( + "execution_model:\n" + " receive:\n" + " env_ctx:\n" + " edi_test_marker: hello\n" + " edi_test_flag: true\n" + ) + record = self.default_record + handler = self.backend._get_exec_handler(record, "receive") + ctx = handler.__self__.env.context + self.assertEqual(ctx.get("edi_test_marker"), "hello") + self.assertEqual(ctx.get("edi_test_flag"), True) + # Action without env_ctx -> handler context not polluted + handler_proc = self.backend._get_exec_handler(record, "process") + self.assertNotIn("edi_test_marker", handler_proc.__self__.env.context) From 1289d7c6e064ffed80dbf34544d8068ff69487b0 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Thu, 28 May 2026 06:36:24 +0000 Subject: [PATCH 2/2] [BOT] post-merge updates --- README.md | 2 +- edi_core_oca/README.rst | 2 +- edi_core_oca/__manifest__.py | 2 +- edi_core_oca/static/description/index.html | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8cb915bcf..864ed7cfc 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ addon | version | maintainers | summary [edi_account_core_oca](edi_account_core_oca/) | 18.0.1.1.1 | etobella | Define EDI Configuration for Account Moves [edi_account_oca](edi_account_oca/) | 18.0.1.1.1 | etobella | Define some component listeners for Account Moves [edi_component_oca](edi_component_oca/) | 18.0.1.1.0 | simahawk etobella | Allow to use Connector as a source in EDI -[edi_core_oca](edi_core_oca/) | 18.0.1.7.0 | simahawk etobella | Define backends, exchange types, exchange records, basic automation and views for handling EDI exchanges. +[edi_core_oca](edi_core_oca/) | 18.0.1.7.1 | simahawk etobella | Define backends, exchange types, exchange records, basic automation and views for handling EDI exchanges. [edi_endpoint_oca](edi_endpoint_oca/) | 18.0.1.0.3 | | Base module allowing configuration of custom endpoints for EDI framework. [edi_exchange_template_oca](edi_exchange_template_oca/) | 18.0.1.3.3 | simahawk | Allows definition of exchanges via templates. [edi_exchange_template_party_data](edi_exchange_template_party_data/) | 18.0.1.0.1 | simahawk | Glue module between edi_exchange_template and edi_party_data diff --git a/edi_core_oca/README.rst b/edi_core_oca/README.rst index 55bdc1e55..67548dee5 100644 --- a/edi_core_oca/README.rst +++ b/edi_core_oca/README.rst @@ -11,7 +11,7 @@ EDI !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:27258fb23153f2660be19d7c76b04c4d09d35d1e240b779076c7f4a9fa66d9f2 + !! source digest: sha256:aa0c40a082ced3e5e5d376f0eaf4c3a4487421a5abc4c22a81665a279bddaad1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/edi_core_oca/__manifest__.py b/edi_core_oca/__manifest__.py index c3a09f07b..2ddb96481 100644 --- a/edi_core_oca/__manifest__.py +++ b/edi_core_oca/__manifest__.py @@ -9,7 +9,7 @@ Define backends, exchange types, exchange records, basic automation and views for handling EDI exchanges. """, - "version": "18.0.1.7.0", + "version": "18.0.1.7.1", "website": "https://github.com/OCA/edi-framework", "development_status": "Beta", "license": "LGPL-3", diff --git a/edi_core_oca/static/description/index.html b/edi_core_oca/static/description/index.html index de6475a29..295dbf5ea 100644 --- a/edi_core_oca/static/description/index.html +++ b/edi_core_oca/static/description/index.html @@ -372,7 +372,7 @@

EDI

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:27258fb23153f2660be19d7c76b04c4d09d35d1e240b779076c7f4a9fa66d9f2 +!! source digest: sha256:aa0c40a082ced3e5e5d376f0eaf4c3a4487421a5abc4c22a81665a279bddaad1 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: LGPL-3 OCA/edi-framework Translate me on Weblate Try me on Runboat

Base EDI backend.