Skip to content

Commit

Permalink
Merge PR #1124 into 14.0
Browse files Browse the repository at this point in the history
Signed-off-by simahawk
  • Loading branch information
OCA-git-bot committed Feb 6, 2025
2 parents 54b439e + 8fcec94 commit 768a5eb
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
3 changes: 2 additions & 1 deletion edi_oca/models/edi_exchange_consumer_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,8 @@ def _edi_send_via_edi(self, exchange_type, backend=None, force=False, **kw):
exchange_record = self._edi_create_exchange_record(
exchange_type, backend=backend
)
if exchange_record:
# If quick exec is on, `exchange_generate_send` already ran
if exchange_record and not exchange_type.quick_exec:
exchange_record.action_exchange_generate_send(**kw)

# TODO: full unit test coverage
Expand Down
2 changes: 1 addition & 1 deletion edi_sale_oca/views/res_partner.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<field name="arch" type="xml">
<group name="edi_main" position="after">
<group name="sale" string="Sale">
<field name="edi_sale_conf_ids" nolabel="1">
<field name="edi_sale_conf_ids" colspan="6" nolabel="1">
<tree>
<field name="name" />
<field name="trigger_id" />
Expand Down
14 changes: 14 additions & 0 deletions edi_xml_oca/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

import xmlunittest

from odoo.addons.component.tests.common import SavepointComponentCase


class XMLTestCaseMixin(xmlunittest.XmlTestMixin):
def _dev_write_example_file(self, test_file, filename, content):
Expand All @@ -22,3 +24,15 @@ def read_test_file(self, filename):
path = os.path.join(os.path.dirname(__file__), "examples", filename)
with open(path, "r") as thefile:
return thefile.read()


class XMLComponentTestCase(SavepointComponentCase, XMLTestCaseMixin):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.backend = cls.env.ref("edi_oca.demo_edi_backend")
cls.handler = cls.backend._find_component(
cls.backend._name,
["edi.xml"],
work_ctx={"schema_path": "edi_xml_oca:tests/fixtures/Test.xsd"},
)
15 changes: 2 additions & 13 deletions edi_xml_oca/tests/test_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
# @author: Simone Orsi <[email protected]>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo.addons.component.tests.common import SavepointComponentCase

from .common import XMLTestCaseMixin
from .common import XMLComponentTestCase

TEST_XML = """<?xml version="1.0" encoding="UTF-8"?>
<xs:element
Expand All @@ -15,17 +14,7 @@
"""


class XMLTestCase(SavepointComponentCase, XMLTestCaseMixin):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.backend = cls.env.ref("edi_oca.demo_edi_backend")
cls.handler = cls.backend._find_component(
cls.backend._name,
["edi.xml"],
work_ctx={"schema_path": "edi_xml_oca:tests/fixtures/Test.xsd"},
)

class XMLTestCase(XMLComponentTestCase):
def test_xml_schema_fail(self):
with self.assertRaises(ValueError):
self.backend._find_component(
Expand Down

0 comments on commit 768a5eb

Please sign in to comment.