# Copyright 2024 Jacques-Etienne Baudoux (BCIM) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from lxml import etree from odoo.tests.common import TransactionCase class TestBaseUblParse(TransactionCase): def test_parse_product_schemeid_gtin(self): xml_string = b""" Acme beeswax beeswax 6578489 17589683 """ xml_root = etree.fromstring(xml_string) ns = xml_root.nsmap product = self.env["base.ubl"].ubl_parse_product(xml_root, ns) self.assertEqual(product.get("barcode"), "6578489") self.assertEqual(product.get("code"), "17589683") def test_parse_product_schemeid_0160(self): xml_string = b""" Acme beeswax beeswax 6578489 17589683 """ xml_root = etree.fromstring(xml_string) ns = xml_root.nsmap product = self.env["base.ubl"].ubl_parse_product(xml_root, ns) self.assertEqual(product.get("barcode"), "6578489") self.assertEqual(product.get("code"), "17589683")