From 6d20a149cc64ab55ae1f4c782b0016a05bb0ddc4 Mon Sep 17 00:00:00 2001 From: "Ricardo Gomes Rodrigues (rigr)" Date: Thu, 29 Sep 2022 08:34:21 +0000 Subject: [PATCH] [FIX] account_edi_ubl_cii: fallback on item name if no description If a user imports a FacturX where an item has a name but no description, the invoice is not created. We now use the item name as a fallback in case there is no description. opw-2951705 closes odoo/odoo#101682 X-original-commit: 8826993ffb658d6df513a3ce4a316c1aa09d428e Signed-off-by: Josse Colpaert Signed-off-by: Ricardo Gomes Rodrigues (rigr) --- .../models/account_edi_xml_ubl_20.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/addons/account_edi_ubl_cii/models/account_edi_xml_ubl_20.py b/addons/account_edi_ubl_cii/models/account_edi_xml_ubl_20.py index 9b05dce63a1..bcc0eb4c7b5 100644 --- a/addons/account_edi_ubl_cii/models/account_edi_xml_ubl_20.py +++ b/addons/account_edi_ubl_cii/models/account_edi_xml_ubl_20.py @@ -563,10 +563,13 @@ class AccountEdiXmlUBL20(models.AbstractModel): if product is not None: invoice_line.product_id = product - # Name - name_node = tree.find('./{*}Item/{*}Description') - if name_node is not None: - invoice_line.name = name_node.text + # Description + description_node = tree.find('./{*}Item/{*}Description') + name_node = tree.find('./{*}Item/{*}Name') + if description_node is not None: + invoice_line.name = description_node.text + elif name_node is not None: + invoice_line.name = name_node.text # Fallback on Name if Description is not found. xpath_dict = { 'basis_qty': [