details: https://code.tryton.org/tryton/commit/e0d1ee7e0c9f
branch: default
user: Cédric Krier <[email protected]>
date: Tue Oct 21 12:07:40 2025 +0200
description:
Make target ids unique when reading related fields
The result is converted into a dict based on the id so we must ensure
that the
ids read are unique in case the same id appears after size limit.
Closes #14304
diffstat:
trytond/trytond/model/modelsql.py | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diffs (12 lines):
diff -r f186b83936db -r e0d1ee7e0c9f trytond/trytond/model/modelsql.py
--- a/trytond/trytond/model/modelsql.py Fri Oct 31 18:04:31 2025 +0100
+++ b/trytond/trytond/model/modelsql.py Tue Oct 21 12:07:40 2025 +0200
@@ -1317,6 +1317,8 @@
if value is not None:
add(value)
related_read_limit = transaction.context.get('related_read_limit')
+ # use dict keys to make target ids unique but preserving the order
+ target_ids = list(dict.fromkeys(target_ids).keys())
rows = Target.read(target_ids[:related_read_limit], fields)
if related_read_limit is not None:
rows += [{'id': i} for i in target_ids[related_read_limit:]]