details: https://code.tryton.org/tryton/commit/da928d2c8c63
branch: 7.4
user: Nicolas Évrard <[email protected]>
date: Wed Nov 26 16:41:20 2025 +0100
description:
Use the form part of view_ids when opening a Many2One in a new tab
Closes #14391
(grafted from e4480cb7619e46c879eb3534560d15e1c68e2fbc)
diffstat:
sao/src/view/form.js | 9 +++++++--
tryton/tryton/common/popup_menu.py | 3 ++-
2 files changed, 9 insertions(+), 3 deletions(-)
diffs (50 lines):
diff -r 03787869fab1 -r da928d2c8c63 sao/src/view/form.js
--- a/sao/src/view/form.js Thu Nov 27 01:14:59 2025 +0100
+++ b/sao/src/view/form.js Wed Nov 26 16:41:20 2025 +0100
@@ -2802,15 +2802,21 @@
} else {
this._popup = true;
}
+ let view_ids = (this.attributes.view_ids || '').split(',');
if (this.has_target(value)) {
var m2o_id =
this.id_from_value(record.field_get(this.field_name));
if (evt && (evt.ctrlKey || evt.metaKey)) {
+ if (!jQuery.isEmptyObject(view_ids)) {
+ // Remove the first tree view as mode is form only
+ view_ids.shift();
+ }
var params = {};
params.model = this.get_model();
params.res_id = m2o_id;
params.mode = ['form'];
params.name = this.attributes.string;
+ params.view_ids = view_ids;
params.context = this.field.get_context(this.record);
Sao.Tab.create(params);
this._popup = false;
@@ -2859,8 +2865,7 @@
context: context,
domain: domain,
order: order,
- view_ids: (this.attributes.view_ids ||
- '').split(','),
+ view_ids: view_ids,
views_preload: (this.attributes.views || {}),
new_: this.create_access,
search_filter: parser.quote(text),
diff -r 03787869fab1 -r da928d2c8c63 tryton/tryton/common/popup_menu.py
--- a/tryton/tryton/common/popup_menu.py Thu Nov 27 01:14:59 2025 +0100
+++ b/tryton/tryton/common/popup_menu.py Wed Nov 26 16:41:20 2025 +0100
@@ -81,9 +81,10 @@
template=template)
def edit(menuitem):
+ view_ids = field.attrs.get('view_ids', '').split(',')
with Window(hide_current=True, allow_similar=True):
Window.create(model,
- view_ids=field.attrs.get('view_ids', '').split(','),
+ view_ids=view_ids[1:],
res_id=id_(record),
mode=['form'],
name=field.attrs.get('string'),