From 6a6fda61bb0de78683441b91943a006e2a19aa6d Mon Sep 17 00:00:00 2001 From: Dorin Hongu Date: Tue, 22 Oct 2024 12:56:30 +0300 Subject: [PATCH] utilizare file_path in loc de get_module_resource --- l10n_ro_etransport/models/stock_picking.py | 8 ++++---- .../tests/test_create_partner_by_vat.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/l10n_ro_etransport/models/stock_picking.py b/l10n_ro_etransport/models/stock_picking.py index 2035a8f5f..843b27405 100644 --- a/l10n_ro_etransport/models/stock_picking.py +++ b/l10n_ro_etransport/models/stock_picking.py @@ -8,7 +8,9 @@ from odoo import _, api, fields, models from odoo.exceptions import UserError -from odoo.modules.module import get_module_resource + +# from odoo.modules.module import get_module_resource +from odoo.tools import file_path _logger = logging.getLogger(__name__) @@ -134,9 +136,7 @@ def get_instastat_code(product): _logger.info(xml_content) xml_doc = etree.fromstring(xml_content.encode()) - schema_file_path = get_module_resource( - "l10n_ro_etransport", "static/schemas", "eTransport.xsd" - ) + schema_file_path = file_path("l10n_ro_etransport/static/schemas/eTransport.xsd") xml_schema = etree.XMLSchema(etree.parse(open(schema_file_path))) is_valid = xml_schema.validate(xml_doc) diff --git a/l10n_ro_partner_create_by_vat/tests/test_create_partner_by_vat.py b/l10n_ro_partner_create_by_vat/tests/test_create_partner_by_vat.py index e9d14cd04..53f6c7ba2 100644 --- a/l10n_ro_partner_create_by_vat/tests/test_create_partner_by_vat.py +++ b/l10n_ro_partner_create_by_vat/tests/test_create_partner_by_vat.py @@ -8,9 +8,11 @@ import requests from odoo.exceptions import ValidationError -from odoo.modules.module import get_module_resource from odoo.tests import Form, tagged +# from odoo.modules.module import get_module_resource +from odoo.tools import file_path + from odoo.addons.account.tests.common import AccountTestInvoicingCommon @@ -22,9 +24,7 @@ def setUpClass(cls, chart_template_ref="ro"): super().setUpClass(chart_template_ref=chart_template_ref) cls.env.company.l10n_ro_accounting = True cls.mainpartner = cls.env["res.partner"].create({"name": "Test partner"}) - test_file_path = get_module_resource( - "l10n_ro_partner_create_by_vat", "tests", "anaf_data.json" - ) + test_file_path = file_path("l10n_ro_partner_create_by_vat/tests/anaf_data.json") cls.anaf_data = json.load(open(test_file_path)) cls.mainpartner = cls.mainpartner.with_context(anaf_data=cls.anaf_data)