From ffe8490aefa344cbf477ef7770a50a8cc3861a55 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 10 Oct 2013 11:11:25 +0200 Subject: Enabled sort in o2m bzr revid: nicolas.vanhoren@openerp.com-20131010091125-0t1v8wmkrn8bnc5y --- addons/web/static/src/js/view_form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index b9f1d91b700..0d4119af74b 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -3542,7 +3542,7 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({ _.extend(view.options, { addable: null, selectable: self.multi_selection, - sortable: false, + sortable: true, import_enabled: false, deletable: true }); -- cgit v1.2.3 From 7d2938394fab7e47f8c0e75d710ada5f06c7a431 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 14 Oct 2013 17:57:09 +0200 Subject: [FIX] null >= 0 is true... bzr revid: xmo@openerp.com-20131014155709-9cg4bzof02bhtyts --- addons/web/static/src/js/view_list.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 74c2fc47aee..4faf5dce1ec 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -503,10 +503,14 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi var reloaded = $.Deferred(); this.$el.find('.oe_list_content').append( this.groups.render(function () { - if (self.dataset.index == null && self.records.length || - self.dataset.index >= self.records.length) { + if (self.dataset.index == null) { + if (self.records.length) { self.dataset.index = 0; + } + } else if (self.dataset.index >= self.records.length) { + self.dataset.index = 0; } + self.compute_aggregates(); reloaded.resolve(); })); -- cgit v1.2.3 From 7040fb35dd8fcba26ca74566fa0d64e7ef07ffbb Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Tue, 15 Oct 2013 10:55:23 +0200 Subject: [FIX] double-escaping of section labels in m2o completion bzr revid: xmo@openerp.com-20131015085523-5s5f587486gaa9zj --- addons/web/static/src/js/search.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 07d1407392e..570c17649c1 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -1547,7 +1547,7 @@ instance.web.search.ManyToOneField = instance.web.search.CharField.extend({ context: context }).then(function (results) { if (_.isEmpty(results)) { return null; } - return [{label: _.escape(self.attrs.string)}].concat( + return [{label: self.attrs.string}].concat( _(results).map(function (result) { return { label: _.escape(result[1]), -- cgit v1.2.3 From 752341f0cb0bb4c77591d66aa9570bdaabbd1b4e Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Tue, 22 Oct 2013 18:25:19 +0200 Subject: [FIX]web: filter name input for custom filters in search dropdown is now required bzr revid: dle@openerp.com-20131022162519-u03cn5k5od8jg6ka --- addons/web/static/src/js/search.js | 5 ++++- addons/web/static/src/xml/base.xml | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index 570c17649c1..78f53506abc 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -1733,7 +1733,10 @@ instance.web.search.CustomFilters = instance.web.search.Input.extend({ var $name = this.$('input:first'); var private_filter = !this.$('#oe_searchview_custom_public').prop('checked'); var set_as_default = this.$('#oe_searchview_custom_default').prop('checked'); - + if (_.isEmpty($name.val())){ + this.do_warn(_t("Error"), _t("Filter name is required.")); + return false; + } var search = this.view.build_search_data(); instance.web.pyeval.eval_domains_and_contexts({ domains: search.domains, diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index c5bc624c2b1..2b8d6fe5efa 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -1620,8 +1620,8 @@

    Save current filter

    -
    -

    + +

    -- cgit v1.2.3 From d524b95172f51f22f7d56f503a72f930de573271 Mon Sep 17 00:00:00 2001 From: xmo <> Date: Fri, 25 Oct 2013 16:55:19 +0200 Subject: [FIX] list view: serialize concurrent calls when loading files and ensure consistency of variables (prevent selection of items in list view lost, opw #599969) bzr revid: mat@openerp.com-20131025145519-jio03azp64ppi5ro --- addons/web/static/src/js/view_list.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 4faf5dce1ec..e2909815324 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -496,7 +496,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi * * @returns {$.Deferred} promise to content reloading */ - reload_content: function () { + reload_content: synchronized(function () { var self = this; self.$el.find('.oe_list_record_selector').prop('checked', false); this.records.reset(); @@ -519,7 +519,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi limit: this._limit }); return reloaded.promise(); - }, + }), reload: function () { return this.reload_content(); }, @@ -1601,6 +1601,22 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we } }); +/** + * Serializes concurrent calls to this asynchronous method. The method must + * return a deferred or promise. + * + * Current-implementation is class-serialized (the mutex is common to all + * instances of the list view). Can be switched to instance-serialized if + * having concurrent list views becomes possible and common. + */ +function synchronized(fn) { + var fn_mutex = new $.Mutex(); + return function () { + var args = _.toArray(arguments); + args.unshift(this); + return fn_mutex.exec(fn.bind.apply(fn, args)); + }; +} var DataGroup = instance.web.Class.extend({ init: function(parent, model, domain, context, group_by, level) { this.model = new instance.web.Model(model, context, domain); -- cgit v1.2.3 From 9edf16f6690f14a98c39d7b24ab5e8ece7b53a88 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 28 Oct 2013 15:16:47 +0100 Subject: [FIX] list: force recompute the selection as closing group reset properties (opw #599969) bzr revid: mat@openerp.com-20131028141647-j6wkvl6plwblh077 --- addons/web/static/src/js/view_list.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index e2909815324..02d0b21d29c 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -1332,6 +1332,9 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we .removeClass('ui-icon-triangle-1-s') .addClass('ui-icon-triangle-1-e'); child.close(); + // force recompute the selection as closing group reset properties + var selection = self.get_selection(); + $(self).trigger('selected', [selection.ids, this.records]); } }); } -- cgit v1.2.3 From a237b0525d546667fbbde2655b80deccdfeec981 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Wed, 30 Oct 2013 19:02:42 +0100 Subject: [FIX] web: allow grouping on fields not present in list view [FIX] web,web_kanban: read_group: ensure read grouping fields bzr revid: chs@openerp.com-20131030180242-rxxlawffv13ll5s1 --- addons/web/static/src/js/view_list.js | 37 +++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 13 deletions(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 02d0b21d29c..d5e9ef501bf 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -1345,22 +1345,29 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we if (group.grouped_on) { var row_data = {}; row_data[group.grouped_on] = group; + var group_label = _t("Undefined"); var group_column = _(self.columns).detect(function (column) { return column.id === group.grouped_on; }); - if (! group_column) { - throw new Error(_.str.sprintf( - _t("Grouping on field '%s' is not possible because that field does not appear in the list view."), - group.grouped_on)); - } - var group_label; - try { - group_label = group_column.format(row_data, { - value_if_empty: _t("Undefined"), - process_modifiers: false - }); - } catch (e) { - group_label = _.str.escapeHTML(row_data[group_column.id].value); + if (group_column) { + try { + group_label = group_column.format(row_data, { + value_if_empty: _t("Undefined"), + process_modifiers: false + }); + } catch (e) { + group_label = _.str.escapeHTML(row_data[group_column.id].value); + } + } else { + group_label = group.value; + if (group_label instanceof Array) { + group_label = group_label[1]; + } + if (group_label === false) { + group_label = _t('Undefined'); + } + group_label = _.str.escapeHTML(group_label); } + // group_label is html-clean (through format or explicit // escaping if format failed), can inject straight into HTML $group_column.html(_.str.sprintf(_t("%s (%d)"), @@ -1631,6 +1638,10 @@ var DataGroup = instance.web.Class.extend({ }, list: function (fields, ifGroups, ifRecords) { var self = this; + if (!_.isEmpty(this.group_by)) { + // ensure group_by fields are read. + fields = _.unique((fields || []).concat(this.group_by)); + } var query = this.model.query(fields).order_by(this.sort).group_by(this.group_by); $.when(query).done(function (querygroups) { // leaf node -- cgit v1.2.3 From 3213ad4dddfee0333b66076b6955c7464c6421c1 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Tue, 5 Nov 2013 13:18:43 +0100 Subject: [FIX] web: instance.web.DataSetSearch.get_domain() returns the domain. lp bug: https://launchpad.net/bugs/1195631 fixed bzr revid: chs@openerp.com-20131105121843-rqplhk83fczxww0t --- addons/web/static/src/js/data.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index e535be294aa..bb658a27bf6 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -724,7 +724,7 @@ instance.web.DataSetSearch = instance.web.DataSet.extend({ }); }, get_domain: function (other_domain) { - this._model.domain(other_domain); + return this._model.domain(other_domain); }, alter_ids: function (ids) { this._super(ids); -- cgit v1.2.3 From 61a8a22f602d735fc891c36033ff0a48b8fb1a42 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Tue, 12 Nov 2013 15:36:35 +0100 Subject: [FIX] web: match base.sass against changes made in base.css in revid 4014 mat@openerp.com-20130821080933-fiq3zvccgzop02on bzr revid: chs@openerp.com-20131112143635-ek6yhfifb6ycynku --- addons/web/static/src/css/base.sass | 1 + 1 file changed, 1 insertion(+) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index b2cca813331..6add7a3174b 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -1877,6 +1877,7 @@ $sheet-padding: 16px width: 100% display: inline-block padding: 2px 2px 2px 0px + vertical-align: top input margin: 0px input[type="text"], input[type="password"], input[type="file"], select -- cgit v1.2.3 From 6cfb4a03707a5f3330cdfaf369b650a4e0054d6b Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Tue, 12 Nov 2013 15:37:46 +0100 Subject: [FIX] web: do not enforce width of dropdown links bzr revid: chs@openerp.com-20131112143746-svdfuqvzvvis6vpy --- addons/web/static/src/css/base.css | 3 --- addons/web/static/src/css/base.sass | 3 --- 2 files changed, 6 deletions(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 9e77fc316b5..edd4d4869a5 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -718,9 +718,6 @@ display: block; color: #4c4c4c; text-decoration: none; - width: 200px; - text-overflow: ellipsis; - overflow: hidden; } .openerp .oe_dropdown_menu > li > a:hover { text-decoration: none; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 6add7a3174b..4814e64c590 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -611,9 +611,6 @@ $sheet-padding: 16px display: block color: #4c4c4c text-decoration: none - width: 200px - text-overflow: ellipsis - overflow: hidden &:hover text-decoration: none .oe_dropdown_arrow:after -- cgit v1.2.3 From 8c3cdce539d87775b59b3f2d5ceb433f995821bf Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Wed, 13 Nov 2013 09:28:06 +0100 Subject: [MERGE] view form: reduce the number of result in 'search more' view opening to 160 records (performances improvement, not filtering every possible record) (opw 593963) bzr revid: mat@openerp.com-20131113082806-me6uy7cjj6holn56 --- addons/web/static/src/js/view_form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 0d4119af74b..bd04b4c75d0 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -2934,7 +2934,7 @@ instance.web.form.CompletionFieldMixin = { values.push({ label: _t("Search More..."), action: function() { - dataset.name_search(search_val, self.build_domain(), 'ilike', false).done(function(data) { + dataset.name_search(search_val, self.build_domain(), 'ilike', 160).done(function(data) { self._search_create_popup("search", data); }); }, -- cgit v1.2.3 From e5ca5a170ce2525e504d864d5041d17be96c4343 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Thu, 14 Nov 2013 12:08:47 +0100 Subject: [FIX] web: list views: bubble up failed deferreds. [FIX] web: list view group: always call post_render method lp bug: https://launchpad.net/bugs/1248531 fixed bzr revid: chs@openerp.com-20131114110847-nn382fc60s7u7wp1 --- addons/web/static/src/js/view_list.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index d5e9ef501bf..b9c789cb6a9 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -1439,14 +1439,13 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we var view = this.view, limit = view.limit(), - d = new $.Deferred(), page = this.datagroup.openable ? this.page : view.page; var fields = _.pluck(_.select(this.columns, function(x) {return x.tag == "field"}), 'name'); var options = { offset: page * limit, limit: limit, context: {bin_size: true} }; //TODO xmo: investigate why we need to put the setTimeout - $.async_when().done(function() { - dataset.read_slice(fields, options).done(function (records) { + return $.async_when().then(function() { + return dataset.read_slice(fields, options).then(function (records) { // FIXME: ignominious hacks, parents (aka form view) should not send two ListView#reload_content concurrently if (self.records.length) { self.records.reset(null, {silent: true}); @@ -1478,13 +1477,12 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we self.records.add(records, {silent: true}); list.render(); - d.resolve(list); if (_.isEmpty(records)) { view.no_result(); } + return list; }); }); - return d.promise(); }, setup_resequence_rows: function (list, dataset) { // drag and drop enabled if list is not sorted and there is a @@ -1564,11 +1562,12 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we self.render_groups(groups)); if (post_render) { post_render(); } }, function (dataset) { - self.render_dataset(dataset).done(function (list) { + self.render_dataset(dataset).then(function (list) { self.children[null] = list; self.elements = [list.$current.replaceAll($el)[0]]; self.setup_resequence_rows(list, dataset); + }).always(function() { if (post_render) { post_render(); } }); }); -- cgit v1.2.3 From 1e4b2695d59b9d51cc1e0b76f925aa4f638436f4 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Thu, 14 Nov 2013 15:26:39 +0100 Subject: [MERGE][FIX] web: fix race condition in BufferedDataset. Backport of saas-2 commit 3867 nicolas.vanhoren@openerp.com-20131107112017-7omd01ocvnbzx9m6 lp bug: https://launchpad.net/bugs/1248531 fixed bzr revid: chs@openerp.com-20131114142639-ng7wzfjwvvel2nhv --- addons/web/static/src/js/data.js | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index bb658a27bf6..d497cf25343 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -761,6 +761,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ this._super.apply(this, arguments); this.reset_ids([]); this.last_default_get = {}; + this.running_reads = []; }, default_get: function(fields, options) { var self = this; @@ -827,6 +828,9 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ this.to_write = []; this.cache = []; this.delete_all = false; + _.each(_.clone(this.running_reads), function(el) { + el.reject(); + }); }, read_ids: function (ids, fields, options) { var self = this; @@ -842,7 +846,6 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ to_get.push(id); } }); - var completion = $.Deferred(); var return_records = function() { var records = _.map(ids, function(id) { return _.extend({}, _.detect(self.cache, function(c) {return c.id === id;}).values, {"id": id}); @@ -877,10 +880,20 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ }, 0); }); } - completion.resolve(records); + return $.when(records); }; if(to_get.length > 0) { - var rpc_promise = this._super(to_get, fields, options).done(function(records) { + var def = $.Deferred(); + self.running_reads.push(def); + def.always(function() { + self.running_reads = _.without(self.running_reads, def); + }); + this._super(to_get, fields, options).then(function() { + def.resolve.apply(def, arguments); + }, function() { + def.reject.apply(def, arguments); + }); + return def.then(function(records) { _.each(records, function(record, index) { var id = to_get[index]; var cached = _.detect(self.cache, function(x) {return x.id === id;}); @@ -891,13 +904,11 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ cached.values = _.defaults(_.clone(cached.values), record); } }); - return_records(); + return return_records(); }); - $.when(rpc_promise).fail(function() {completion.reject();}); } else { - return_records(); + return return_records(); } - return completion.promise(); }, /** * Invalidates caching of a record in the dataset to ensure the next read -- cgit v1.2.3