details:   https://code.tryton.org/tryton/commit/23e3d3d1d1b1
branch:    7.0
user:      Cédric Krier <[email protected]>
date:      Tue Oct 28 17:17:31 2025 +0100
description:
        Use the view_ids attribute to open the Many2One target from tree view

        Closes #14327
        (grafted from 34ffdbb7306e9d8158a91e056b0e06fe17b63091)
diffstat:

 sao/src/view/tree.js |  6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diffs (22 lines):

diff -r bcdd80d73e7f -r 23e3d3d1d1b1 sao/src/view/tree.js
--- a/sao/src/view/tree.js      Sun Nov 02 14:33:49 2025 +0100
+++ b/sao/src/view/tree.js      Tue Oct 28 17:17:31 2025 +0100
@@ -2605,12 +2605,18 @@
             cell = cell.children('a');
             cell.unbind('click');
             Sao.View.Tree.Many2OneColumn._super.update_text.call(this, cell, 
record);
+            let view_ids = (this.attributes.view_ids || '').split(',');
+            if (!jQuery.isEmptyObject(view_ids)) {
+                // Remove the first tree view as mode is form only
+                view_ids.shift();
+            }
             cell.click(event => {
                 event.stopPropagation();
                 var params = {};
                 params.model = this.attributes.relation;
                 params.res_id = this.field.get(record);
                 params.mode = ['form'];
+                params.view_ids = view_ids;
                 params.name = this.attributes.string;
                 params.context = this.field.get_context(record);
                 Sao.Tab.create(params);

Reply via email to