From 3378f9c771910fb61a13a452a8f8a1fb577b9c23 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Tue, 11 Oct 2016 16:12:19 +0200 Subject: [PATCH] [FIX] web: correctly saves last change in wizards with many2omany With this change, form_relational_widgets will wait for the 'web.ListEditor' module to be loaded before patching the list view. This is particularly important for wizards containing and editable list view. Note that to achieve this, I had to fix a horrible hack in session. --- addons/web/static/src/js/framework/session.js | 9 ++++++--- .../web/static/src/js/views/form_relational_widgets.js | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/js/framework/session.js b/addons/web/static/src/js/framework/session.js index 18fccecc331..6af97721926 100644 --- a/addons/web/static/src/js/framework/session.js +++ b/addons/web/static/src/js/framework/session.js @@ -141,9 +141,12 @@ var Session = core.Class.extend(mixins.EventDispatcherMixin, { } var def = this._groups_def[group]; if (!def) { - var Model = window.openerp.web.Model; - var Users = new Model('res.users'); - def = this._groups_def[group] = Users.call('has_group', [group]); + def = this._groups_def[group] = this.rpc('/web/dataset/call_kw/res.users/has_group', { + "model": "res.users", + "method": "has_group", + "args": [group], + "kwargs": {} + }); } return def; }, diff --git a/addons/web/static/src/js/views/form_relational_widgets.js b/addons/web/static/src/js/views/form_relational_widgets.js index 00640696b41..d6b61f2313e 100644 --- a/addons/web/static/src/js/views/form_relational_widgets.js +++ b/addons/web/static/src/js/views/form_relational_widgets.js @@ -7,6 +7,7 @@ var data = require('web.data'); var Dialog = require('web.Dialog'); var common = require('web.form_common'); var ListView = require('web.ListView'); +require('web.ListEditor'); // one must be sure that the include of ListView are done (for eg: add start_edition methods) var Model = require('web.DataModel'); var session = require('web.session'); var utils = require('web.utils');