diff options
| author | Christophe Simonis <chs@odoo.com> | 2016-03-24 16:53:45 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2016-03-24 16:53:45 +0100 |
| commit | ddb0fb273982399f7618a017eeb81d6a5253575a (patch) | |
| tree | f62aea4a3888d45e8bfe0f17baeb4ab9d0b47f41 /addons/web/static/src/js/framework | |
| parent | d8137d35b7cc30df258fc310074eca3bfd88ec7a (diff) | |
| parent | 59d3f63c58b47dfc1991494f167216cc1d9a9469 (diff) | |
[MERGE] forward port of branch saas-9 up to 59d3f63
Diffstat (limited to 'addons/web/static/src/js/framework')
| -rw-r--r-- | addons/web/static/src/js/framework/data.js | 20 | ||||
| -rw-r--r-- | addons/web/static/src/js/framework/dialog.js | 2 | ||||
| -rw-r--r-- | addons/web/static/src/js/framework/pyeval.js | 12 |
3 files changed, 22 insertions, 12 deletions
diff --git a/addons/web/static/src/js/framework/data.js b/addons/web/static/src/js/framework/data.js index e92bbd98c53..a1b8e1602e9 100644 --- a/addons/web/static/src/js/framework/data.js +++ b/addons/web/static/src/js/framework/data.js @@ -833,9 +833,10 @@ var BufferedDataSet = DataSetStatic.extend({ }); } this.delete_all = false; - _.each(_.clone(this.running_reads), function(el) { - el.reject(); - }); + this.cancel_read(); + }, + cancel_read: function () { + _.invoke(_.clone(this.running_reads), 'reject'); }, read_ids: function (ids, fields, options) { // read what is necessary from the server to have ids and the given @@ -897,11 +898,8 @@ var BufferedDataSet = DataSetStatic.extend({ }); var _super = this._super; this.mutex.exec(function () { - _super.call(self, to_get, fields, options).then(function() { - def.resolve.apply(def, arguments); - }, function() { - def.reject.apply(def, arguments); - }); + if (def.state() !== "pending") return; + _super.call(self, to_get, fields, options).then(_.bind(def.resolve, def), _.bind(def.reject, def)); return def; }); return def.then(function(records) { @@ -942,11 +940,11 @@ var BufferedDataSet = DataSetStatic.extend({ this.evict_record(id); return this._super(id, signal); }, - alter_ids: function(n_ids) { + alter_ids: function(n_ids, options) { var dirty = !_.isEqual(this.ids, n_ids); - this._super(n_ids); + this._super(n_ids, options); if (dirty) { - this.trigger("dataset_changed", n_ids); + this.trigger("dataset_changed", n_ids, options); } }, }); diff --git a/addons/web/static/src/js/framework/dialog.js b/addons/web/static/src/js/framework/dialog.js index cbd3baa2a85..f401cf78591 100644 --- a/addons/web/static/src/js/framework/dialog.js +++ b/addons/web/static/src/js/framework/dialog.js @@ -144,7 +144,7 @@ var Dialog = Widget.extend({ this.$modal.remove(); setTimeout(function () { // Keep class modal-open (deleted by bootstrap hide fnct) on body to allow scrolling inside the modal - var modals = $('body > .modal'); + var modals = $('body > .modal').filter(':visible'); if(modals.length) { modals.last().focus(); $('body').addClass('modal-open'); diff --git a/addons/web/static/src/js/framework/pyeval.js b/addons/web/static/src/js/framework/pyeval.js index ce25e7af534..2b553d37e0f 100644 --- a/addons/web/static/src/js/framework/pyeval.js +++ b/addons/web/static/src/js/framework/pyeval.js @@ -757,6 +757,12 @@ var wrapping_dict = py.type('wrapping_dict', null, { __getattr__: function (key) { return this.__getitem__(py.str.fromJSON(key)); }, + __len__: function () { + return Object.keys(this._store).length + }, + __nonzero__: function () { + return py.PY_size(this) > 0 ? py.True : py.False; + }, get: function () { var args = py.PY_parseArgs(arguments, ['k', ['d', py.None]]); @@ -780,6 +786,12 @@ var wrapping_list = py.type('wrapping_list', null, { __getitem__: function (index) { return wrap(this._store[index.toJSON()]); }, + __len__: function () { + return this._store.length; + }, + __nonzero__: function () { + return py.PY_size(this) > 0 ? py.True : py.False; + }, fromJSON: function (ar) { var instance = py.PY_call(wrapping_list); instance._store = ar; |
