details: https://code.tryton.org/tryton/commit/f82dbdfeab73
branch: default
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
diffstat:
modules/edocument_ubl/edocument.py | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
diffs (35 lines):
diff -r bf1e38173774 -r f82dbdfeab73 modules/edocument_ubl/edocument.py
--- a/modules/edocument_ubl/edocument.py Mon Jan 19 11:48:55 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