From 21bf2e841be8310318623938b5586621b49ecdc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 11 Nov 2023 19:31:35 +0100 Subject: [PATCH] Do not execute action on row active if there is no selected id Closes #12731 (grafted from 00d2bb38f0b68c817b3c97b822c66ccda53855e4) --HG-- branch : 6.0 --- sao/src/sao.js | 13 ++++++++----- sao/src/screen.js | 13 ++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/sao/src/sao.js b/sao/src/sao.js index aaf6c38267..0eef4845b3 100644 --- a/sao/src/sao.js +++ b/sao/src/sao.js @@ -716,11 +716,14 @@ var Sao = {}; Sao.main_menu_row_activate = function() { var screen = Sao.main_menu_screen; - // ids is not defined to prevent to add suffix - return Sao.Action.exec_keyword('tree_open', { - 'model': screen.model_name, - 'id': screen.get_id(), - }, null, false); + var id = screen.get_id(); + if (id) { + // ids is not defined to prevent to add suffix + Sao.Action.exec_keyword('tree_open', { + 'model': screen.model_name, + 'id': screen.get_id(), + }, null, false); + } }; Sao.menu = function(preferences) { diff --git a/sao/src/screen.js b/sao/src/screen.js index b1e3f49cd8..96f8e11abd 100644 --- a/sao/src/screen.js +++ b/sao/src/screen.js @@ -1444,11 +1444,14 @@ default_row_activate: function() { if ((this.current_view.view_type == 'tree') && (this.current_view.attributes.keyword_open == 1)) { - Sao.Action.exec_keyword('tree_open', { - 'model': this.model_name, - 'id': this.get_id(), - 'ids': [this.get_id()] - }, this.local_context, false); + var id = this.get_id(); + if (id) { + Sao.Action.exec_keyword('tree_open', { + 'model': this.model_name, + 'id': this.get_id(), + 'ids': [this.get_id()] + }, this.local_context, false); + } } else { if (!this.modified()) { this.switch_view('form');