details:   https://code.tryton.org/tryton/commit/6a34531050a9
branch:    7.8
user:      Cédric Krier <[email protected]>
date:      Mon Jan 19 11:43:28 2026 +0100
description:
        Use schemeID to search for identifier of the same type

        Closes #14516
        (grafted from f82dbdfeab73f717e1f433c9e6f6a58e06e87f19)
diffstat:

 modules/edocument_ubl/edocument.py |  16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diffs (35 lines):

diff -r c3adbccb09bb -r 6a34531050a9 modules/edocument_ubl/edocument.py
--- a/modules/edocument_ubl/edocument.py        Mon Jan 19 11:34:14 2026 +0100
+++ b/modules/edocument_ubl/edocument.py        Mon Jan 19 11:43:28 2026 +0100
@@ -636,8 +636,14 @@
                 party_el.iterfind('./{*}PartyTaxScheme/{*}CompanyID'),
                 ):
             if identifier.text:
+                domain = [
+                    ('code', '=', identifier.text),
+                    ]
+                if schemeId := identifier.get('schemeID'):
+                    if type := ISO6523.get(schemeId):
+                        domain.append(('type', '=', type))
                 parties = Party.search([
-                        ('identifiers.code', '=', identifier.text),
+                        ('identifiers', 'where', domain),
                         ])
                 if len(parties) == 1:
                     party, = parties
@@ -791,8 +797,14 @@
                 party_el.iterfind('./{*}PartyLegalEntity/{*}CompanyID'),
                 ):
             if identifier.text:
+                domain = [
+                    ('code', '=', identifier.text),
+                    ]
+                if schemeId := identifier.get('schemeID'):
+                    if type := ISO6523.get(schemeId):
+                        domain.append(('type', '=', type))
                 companies = Company.search([
-                        ('party.identifiers.code', '=', identifier.text),
+                        ('party.identifiers', 'where', domain),
                         ])
                 if len(companies) == 1:
                     company, = companies

Reply via email to