From 451a5b9fc767e75c2c9b093c77771de1d5f22d08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 19 Jan 2026 11:34:14 +0100 Subject: [PATCH] Create the party name using the registration name of the legal entity from UBL first Closes #14514 --- modules/edocument_ubl/edocument.py | 4 +++- .../edocument_ubl/tests/scenario_ubl_2_credit_note_parse.rst | 4 ++-- modules/edocument_ubl/tests/scenario_ubl_2_invoice_parse.rst | 4 ++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/edocument_ubl/edocument.py b/modules/edocument_ubl/edocument.py index 41a8b04fd6..82c004ec71 100644 --- a/modules/edocument_ubl/edocument.py +++ b/modules/edocument_ubl/edocument.py @@ -644,7 +644,9 @@ class Invoice(Model): pool = Pool() Party = pool.get('party.party') party = Party() - party.name = party_el.findtext('./{*}PartyName/{*}Name') + party.name = ( + party_el.findtext('./{*}PartyLegalEntity/{*}RegistrationName') + or party_el.findtext('./{*}PartyName/{*}Name')) identifiers = [] for identifier in party_el.iterfind('./{*}PartyIdentification/{*}ID'): if identifier.text: diff --git a/modules/edocument_ubl/tests/scenario_ubl_2_credit_note_parse.rst b/modules/edocument_ubl/tests/scenario_ubl_2_credit_note_parse.rst index 5485b4f625..1a07094b76 100644 --- a/modules/edocument_ubl/tests/scenario_ubl_2_credit_note_parse.rst +++ b/modules/edocument_ubl/tests/scenario_ubl_2_credit_note_parse.rst @@ -70,9 +70,9 @@ Parse the UBL invoice:: 'TOSL108' >>> assertEqual(invoice.invoice_date, dt.date(2009, 12, 15)) >>> invoice.party.name - 'Salescompany ltd.' + 'The Sellercompany Incorporated' >>> invoice.invoice_address.rec_name - 'Salescompany ltd., Main street 1 5467, 54321, Big city' + 'The Sellercompany Incorporated, Main street 1 5467, 54321, Big city' >>> assertEqual(invoice.company, company) >>> assertEqual( ... invoice.total_amount, diff --git a/modules/edocument_ubl/tests/scenario_ubl_2_invoice_parse.rst b/modules/edocument_ubl/tests/scenario_ubl_2_invoice_parse.rst index 85390095fc..ed6250046f 100644 --- a/modules/edocument_ubl/tests/scenario_ubl_2_invoice_parse.rst +++ b/modules/edocument_ubl/tests/scenario_ubl_2_invoice_parse.rst @@ -70,9 +70,9 @@ Parse the UBL invoice:: 'TOSL108' >>> assertEqual(invoice.invoice_date, dt.date(2009, 12, 15)) >>> invoice.party.name - 'Salescompany ltd.' + 'The Sellercompany Incorporated' >>> invoice.invoice_address.rec_name - 'Salescompany ltd., Main street 1 5467, 54321, Big city' + 'The Sellercompany Incorporated, Main street 1 5467, 54321, Big city' >>> assertEqual(invoice.company, company) >>> assertEqual( ... invoice.total_amount,