changeset 6cd3c1ef2cfa in tryton:5.0
details: https://hg.tryton.org/tryton?cmd=changeset&node=6cd3c1ef2cfa
description:
Call directly the callback when search has a unique result
We can not rely on the response because it is using the selection which
may not
be filled.
issue11632
review411541003
(grafted from 3213c545da10db54ded880a5dd98f6d90bbf5822)
diffstat:
tryton/gui/window/view_form/view/form_gtk/many2many.py | 5 ++++-
tryton/gui/window/view_form/view/form_gtk/many2one.py | 5 ++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diffs (30 lines):
diff -r 3b2eaa2cec5b -r 6cd3c1ef2cfa
tryton/gui/window/view_form/view/form_gtk/many2many.py
--- a/tryton/gui/window/view_form/view/form_gtk/many2many.py Sat Aug 06
10:35:11 2022 +0200
+++ b/tryton/gui/window/view_form/view/form_gtk/many2many.py Mon Aug 08
22:21:49 2022 +0200
@@ -163,7 +163,10 @@
title=self.attrs.get('string'))
win.screen.search_filter(quote(value))
if len(win.screen.group) == 1:
- win.response(None, gtk.RESPONSE_OK)
+ callback([
+ (r.id, r.value.get('rec_name', ''))
+ for r in win.screen.group])
+ win.destroy()
else:
win.show()
diff -r 3b2eaa2cec5b -r 6cd3c1ef2cfa
tryton/gui/window/view_form/view/form_gtk/many2one.py
--- a/tryton/gui/window/view_form/view/form_gtk/many2one.py Sat Aug 06
10:35:11 2022 +0200
+++ b/tryton/gui/window/view_form/view/form_gtk/many2one.py Mon Aug 08
22:21:49 2022 +0200
@@ -140,7 +140,10 @@
title=self.attrs.get('string'))
win.screen.search_filter(quote(text))
if len(win.screen.group) == 1:
- win.response(None, gtk.RESPONSE_OK)
+ callback([
+ (r.id, r.value.get('rec_name', ''))
+ for r in win.screen.group])
+ win.destroy()
else:
win.show()
return