From 7f128e5073b6381bc036b950d1a2b359ddf6602f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 22 Feb 2022 23:06:02 +0100 Subject: [PATCH] Use dictionary as search_order on Reference field issue11251 review387941002 --- tryton/gui/window/view_form/model/field.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tryton/gui/window/view_form/model/field.py b/tryton/gui/window/view_form/model/field.py index 14d7ca3258..808cceb0b0 100644 --- a/tryton/gui/window/view_form/model/field.py +++ b/tryton/gui/window/view_form/model/field.py @@ -973,6 +973,16 @@ class ReferenceField(Field): return concat(localize_domain( screen_domain, self.name, strip_target=True), attr_domain) + def get_search_order(self, record): + order = super().get_search_order(record) + if order is not None: + if record.value.get(self.name): + model = record.value[self.name][0] + else: + model = None + order = order.get(model) + return order + def get_models(self, record): screen_domain, attr_domain = self.domains_get(record) screen_domain = prepare_reference_domain(screen_domain, self.name)