diff --git a/CHANGELOG b/CHANGELOG index b2b3367124..3e689768e3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Limit board action domain to active id and ids * Manage creatable attribute of view Version 6.2.0 - 2021-11-01 diff --git a/src/board.js b/src/board.js index 7207c7993b..391cf74b9d 100644 --- a/src/board.js +++ b/src/board.js @@ -116,7 +116,6 @@ ctx.context = ctx; decoder = new Sao.PYSON.Decoder(ctx); - params.domain = decoder.decode(action.pyson_domain); params.order = decoder.decode(action.pyson_order); params.search_value = decoder.decode( action.pyson_search_value || '[]'); @@ -189,9 +188,20 @@ record_message: function() { this.view.active_changed(this); }, - get_active: function() { + get active() { if (this.screen && this.screen.current_record) { - return Sao.common.EvalEnvironment(this.screen.current_record); + return { + 'active_id': this.screen.current_record.id, + 'active_ids': this.screen.selected_records.map( + function(r) { + return r.id; + }), + }; + } else { + return { + 'active_id': null, + 'active_ids': [], + }; } }, update_domain: function(actions) { @@ -199,13 +209,9 @@ var active, domain_ctx, decoder, new_domain; domain_ctx = jQuery.extend({}, this.context); - domain_ctx.context = domain_ctx; - domain_ctx._user = Sao.Session.current_session.user_id; + domain_ctx._actions = {}; for (i = 0, len = actions.length; i < len; i++) { - active = actions[i].get_active(); - if (active) { - domain_ctx[actions[i].name] = active; - } + domain_ctx._actions[actions[i].name] = actions[i].active; } decoder = new Sao.PYSON.Decoder(domain_ctx); new_domain = decoder.decode(this.action.pyson_domain);