From bde1a4432fef4cb2f5fe8ab600e72ab5b8b4830d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Thu, 20 Nov 2014 10:26:13 +0100 Subject: [FIX] fix autocompletion problems with quick presses Problem was that when the user types quickly in the search bar and press enter, the keydown event of the enter key happens before the keypress event of the last key entered. This means that the autocompletion has a wrong string. The fix is to move the enter selection detection from keydown to keyup. --- addons/web/static/src/js/search.js | 7 ++++++- 1 file changed, 6 insertions(+), 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 9b155054774..e1b96d5d7fc 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -2362,6 +2362,12 @@ instance.web.search.AutoComplete = instance.web.Widget.extend({ ev.preventDefault(); return; } + if (ev.which === $.ui.keyCode.ENTER) { + if (self.current_result && self.get_search_string().length) { + self.select_item(ev); + } + return; + } if (!self.searching) { self.searching = true; return; @@ -2377,7 +2383,6 @@ instance.web.search.AutoComplete = instance.web.Widget.extend({ this.$input.on('keydown', function (ev) { switch (ev.which) { case $.ui.keyCode.TAB: - case $.ui.keyCode.ENTER: if (self.current_result && self.get_search_string().length) { self.select_item(ev); } -- cgit v1.2.3 From 784665e6bdfac6501f941600303aa69612657ff4 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Mon, 24 Nov 2014 18:45:22 +0100 Subject: [DOC] web: search view: extra info about key events handling Complements bde1a4432fef4cb2f5fe8ab600e72ab5b8b4830d --- addons/web/static/src/js/search.js | 5 +++++ 1 file changed, 5 insertions(+) (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 e1b96d5d7fc..82ba081e0de 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -2362,6 +2362,8 @@ instance.web.search.AutoComplete = instance.web.Widget.extend({ ev.preventDefault(); return; } + // ENTER is caugth at KeyUp rather than KeyDown to avoid firing + // before all regular keystrokes have been processed if (ev.which === $.ui.keyCode.ENTER) { if (self.current_result && self.get_search_string().length) { self.select_item(ev); @@ -2382,6 +2384,9 @@ instance.web.search.AutoComplete = instance.web.Widget.extend({ }); this.$input.on('keydown', function (ev) { switch (ev.which) { + // TAB and direction keys are handled at KeyDown because KeyUp + // is not guaranteed to fire. + // See e.g. https://github.com/aef-/jquery.masterblaster/issues/13 case $.ui.keyCode.TAB: if (self.current_result && self.get_search_string().length) { self.select_item(ev); -- cgit v1.2.3 From 20a8b0e66a86c130f7b005aa9a5efead05eb0014 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Tue, 25 Nov 2014 13:11:15 +0100 Subject: [FIX] correctly set searchview id (web client) The issue is that when a default searchview is requested, it is initialized without its view_id. Result: debug mode can't edit the search view. This commit makes sure that when the field_view_get is received, the correct view_id is set. --- addons/web/static/src/js/search.js | 1 + 1 file changed, 1 insertion(+) (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 82ba081e0de..797bd5de3d6 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -598,6 +598,7 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea search_view_loaded: function(data) { var self = this; this.fields_view = data; + this.view_id = this.view_id || data.view_id; if (data.type !== 'search' || data.arch.tag !== 'search') { throw new Error(_.str.sprintf( -- cgit v1.2.3 From f0e331e005d830d8b5aaa4cb5e2824d98bd75b2a Mon Sep 17 00:00:00 2001 From: Pierre Verkest Date: Thu, 6 Nov 2014 16:18:33 +0100 Subject: [FIX] correctly update many2many in listview (web client) Fixes the issue #1216 (follow the link for more information). The issue was caused by a hack in list view: the magical suffix __display is used in render_cell to determine if a many2many field should be updated. This commit simply makes sure that old many2many fields + __display keys are cleared. A better way would be to redesign/refactor the list view to avoid that hack in the first place. But this would be a much more complex task. --- addons/web/static/src/js/view_list.js | 5 +++-- 1 file changed, 3 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 52124d5f896..f9c857c957c 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -541,8 +541,9 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi self.records.remove(record); return; } - _(_.keys(values)).each(function(key){ - record.set(key, values[key], {silent: true}); + _.each(values, function (value, key) { + record.set(key + '__display', false, {silent: true}); + record.set(key, value, {silent: true}); }); record.trigger('change', record); }); -- cgit v1.2.3 From 62bc63e44f470ce0d6003fcc1fb9fd2d16350e4e Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Thu, 27 Nov 2014 15:19:39 +0100 Subject: [FIX] web: force company_logo change on company change In multi company environment, the company logo was not updated on company change in the user preferences This disrupted the end user, as he might think the company change did not happen. --- addons/web/static/src/js/chrome.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index bbf36152735..a9a458c8e78 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -1292,7 +1292,8 @@ instance.web.WebClient = instance.web.Client.extend({ } }, update_logo: function() { - var img = this.session.url('/web/binary/company_logo'); + var company = this.session.company_id; + var img = this.session.url('/web/binary/company_logo' + (company ? '?company=' + company : '')); this.$('.oe_logo img').attr('src', '').attr('src', img); this.$('.oe_logo_edit').toggleClass('oe_logo_edit_admin', this.session.uid === 1); }, -- cgit v1.2.3 From 5f47fc84e93cddac3d38239cd042c420c3ca0463 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Thu, 27 Nov 2014 17:04:02 +0100 Subject: [FIX] web: m2o search facet do no set `default_*` context key for "name_search" values --- addons/web/static/src/js/search.js | 5 ++++- 1 file changed, 4 insertions(+), 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 797bd5de3d6..eea50707035 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -1699,7 +1699,10 @@ instance.web.search.ManyToOneField = instance.web.search.CharField.extend({ var values = facet.values; if (_.isEmpty(this.attrs.context) && values.length === 1) { var c = {}; - c['default_' + this.attrs.name] = values.at(0).get('value'); + var v = values.at(0); + if (v.get('operator') !== 'ilike') { + c['default_' + this.attrs.name] = v.get('value'); + } return c; } return this._super(facet); -- cgit v1.2.3 From 45551cf78c11d70a68a695110ddb8a76a38578fa Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 28 Nov 2014 13:36:42 +0100 Subject: [FIX] web: use mutex to wait for onchanges This fix is related to c12a2e1d1650d308e39cc2b396a76eed579e2595 Mutex allow to wait sequentially for mutex Besides, if one of the onchanges deferreds fails, it does not resolve the mutex until all deferreds of the mutex are resolved. Besides, we now wait for the onchanges mutex between each field commited value (line 596) in case the commited value leaded to a new onchanges, that we should wait for before commiting the rest of the values. --- addons/web/static/src/js/view_form.js | 96 +++++++++++++++++------------------ 1 file changed, 47 insertions(+), 49 deletions(-) (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 584f89fffba..ccb6475e01d 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -103,7 +103,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM this.fields_order = []; this.datarecord = {}; this._onchange_specs = {}; - this.onchanges_defs = []; + this.onchanges_mutex = new $.Mutex(); this.default_focus_field = null; this.default_focus_button = null; this.fields_registry = instance.web.form.widgets; @@ -509,44 +509,45 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM def = self.alive(new instance.web.Model(self.dataset.model).call( "onchange", [ids, values, trigger_field_name, onchange_specs, context])); } - var onchange_def = def.then(function(response) { - if (widget && widget.field['change_default']) { - var fieldname = widget.name; - var value_; - if (response.value && (fieldname in response.value)) { - // Use value from onchange if onchange executed - value_ = response.value[fieldname]; - } else { - // otherwise get form value for field - value_ = self.fields[fieldname].get_value(); - } - var condition = fieldname + '=' + value_; - - if (value_) { - return self.alive(new instance.web.Model('ir.values').call( - 'get_defaults', [self.model, condition] - )).then(function (results) { - if (!results.length) { + this.onchanges_mutex.exec(function(){ + return def.then(function(response) { + if (widget && widget.field['change_default']) { + var fieldname = widget.name; + var value_; + if (response.value && (fieldname in response.value)) { + // Use value from onchange if onchange executed + value_ = response.value[fieldname]; + } else { + // otherwise get form value for field + value_ = self.fields[fieldname].get_value(); + } + var condition = fieldname + '=' + value_; + + if (value_) { + return self.alive(new instance.web.Model('ir.values').call( + 'get_defaults', [self.model, condition] + )).then(function (results) { + if (!results.length) { + return response; + } + if (!response.value) { + response.value = {}; + } + for(var i=0; i Date: Mon, 1 Dec 2014 10:29:00 +0100 Subject: [FIX] fix editing one2many in some cases (web) See issue #3964 for more detail. Main problem was caused by commit f0e331e005d8. It set the key name+'__display' to false when reloading a record for all field types, but it was only concerned with many2many. --- addons/web/static/src/js/view_list.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (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 f9c857c957c..3a3e8d55848 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -528,6 +528,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi }, reload_record: function (record) { var self = this; + var fields = this.fields_view.fields; // Use of search_read instead of read to check if we can still read the record (security rules) return this.dataset.read_ids( [record.get('id')], @@ -542,7 +543,8 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi return; } _.each(values, function (value, key) { - record.set(key + '__display', false, {silent: true}); + if (fields[key] && fields[key].type === 'many2many') + record.set(key + '__display', false, {silent: true}); record.set(key, value, {silent: true}); }); record.trigger('change', record); -- cgit v1.2.3 From aba75e75781e6f44c4d8b0ce21fa41cf48f9ed3d Mon Sep 17 00:00:00 2001 From: Jacques-Etienne Baudoux Date: Fri, 28 Nov 2014 14:22:56 +0100 Subject: [FIX] base: oe_subtotal_footer_separator width Make sure a too long value in the subtotal will not overlap the form sheet Fixes #3698 --- addons/web/static/src/css/base.css | 2 +- addons/web/static/src/css/base.sass | 2 +- 2 files changed, 2 insertions(+), 2 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 1c1b934180a..aa48fd3639f 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -1957,7 +1957,7 @@ border-right: none; } .openerp .oe_form .oe_subtotal_footer .oe_subtotal_footer_separator { - width: 108px; + min-width: 108px; border-top: 1px solid #cacaca; margin-top: 4px; padding-top: 4px; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index f139b9ea56d..908ad90c890 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -1616,7 +1616,7 @@ $sheet-padding: 16px td.oe_form_group_cell_label border-right: none .oe_subtotal_footer_separator - width: 108px + min-width: 108px border-top: 1px solid #cacaca margin-top: 4px padding-top: 4px -- cgit v1.2.3