From e1d4b48d8e6ccb7214a3ae5039a62171f5009345 Mon Sep 17 00:00:00 2001 From: tanghulu0608 Date: Tue, 21 Aug 2018 11:18:32 +0200 Subject: [FIX] web: correctly apply pdf_viewer style The pdf_viewer widget has been moved from mrp to web in rev. odoo/odoo@a7b521f but the corresponding style was still in the mrp module. It's now put in the right place. Closes #26449 --- addons/web/static/src/less/fields.less | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/less/fields.less b/addons/web/static/src/less/fields.less index 3f4e424e14f..fdffd035456 100644 --- a/addons/web/static/src/less/fields.less +++ b/addons/web/static/src/less/fields.less @@ -387,4 +387,12 @@ } } } + + // PDF Viewer + &.o_field_pdfviewer, .o_pdfview_iframe { + width: 100%; + height: 450px; + border: 0; + margin-top: 10px; + } } -- cgit v1.2.3 From a66650a7fa4bdb8e728ee2edd4ac9109701704fc Mon Sep 17 00:00:00 2001 From: David Monjoie Date: Wed, 22 Aug 2018 15:50:41 +0200 Subject: [FIX] web: esc cancels kanban column quick create The feature was already declared in AbstractQuickCreate, but the ColumnQuickCreate object did not define a _cancel function. --- .../web/static/src/js/views/kanban/kanban_quick_create.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/views/kanban/kanban_quick_create.js b/addons/web/static/src/js/views/kanban/kanban_quick_create.js index 216cf1bbe88..559f508e37e 100644 --- a/addons/web/static/src/js/views/kanban/kanban_quick_create.js +++ b/addons/web/static/src/js/views/kanban/kanban_quick_create.js @@ -266,6 +266,19 @@ var ColumnQuickCreate = AbstractQuickCreate.extend({ // Private //-------------------------------------------------------------------------- + /** + * Triggers up an event to cancel the quick creation + * + * @override + * @private + */ + _cancel: function () { + if (!this.folded) { + this.folded = true; + this.$input.val(''); + this._update(); + } + }, /** * Triggers up an event to quick create a column with the given value * -- cgit v1.2.3 From 4015c84633c2f0854181deb0dcfbb0c87f639d36 Mon Sep 17 00:00:00 2001 From: sed-odoo Date: Wed, 22 Aug 2018 15:40:21 +0200 Subject: [FIX] web: Disable keyboard shortcuts on BlockUI Related to the bug: 1874270 Purpose ======= Keyboard shortcuts working on BlockUI and can cause some issues when used. Specification ============= It should not work and should not be display while some process is being executed. - add function to remove the "accesskey" attributes to avoid the use of the access keys while the blockUI is enable. - add function to reset the "accesskey" attributes when the blockUI is disable. - add condition to avoid the "Alt" key to reattribute access keys. --- .../src/js/chrome/keyboard_navigation_mixin.js | 8 +++++++ addons/web/static/src/js/core/misc.js | 25 ++++++++++++++++++++++ 2 files changed, 33 insertions(+) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/chrome/keyboard_navigation_mixin.js b/addons/web/static/src/js/chrome/keyboard_navigation_mixin.js index d0eed176d9c..6fec5795bee 100644 --- a/addons/web/static/src/js/chrome/keyboard_navigation_mixin.js +++ b/addons/web/static/src/js/chrome/keyboard_navigation_mixin.js @@ -103,6 +103,14 @@ odoo.define('web.KeyboardNavigationMixin', function (require) { * return {undefined|false} */ _onKeyDown: function (keyDownEvent) { + if ($('body.o_ui_blocked').length && + (keyDownEvent.altKey || keyDownEvent.key === 'Alt') && + !keyDownEvent.ctrlKey) { + if (keyDownEvent.preventDefault) keyDownEvent.preventDefault(); else keyDownEvent.returnValue = false; + if (keyDownEvent.stopPropagation) keyDownEvent.stopPropagation(); + if (keyDownEvent.cancelBubble) keyDownEvent.cancelBubble = true; + return false; + } if (!this._areAccessKeyVisible && (keyDownEvent.altKey || keyDownEvent.key === 'Alt') && !keyDownEvent.ctrlKey) { diff --git a/addons/web/static/src/js/core/misc.js b/addons/web/static/src/js/core/misc.js index be0f012752c..cd9a73ef22b 100644 --- a/addons/web/static/src/js/core/misc.js +++ b/addons/web/static/src/js/core/misc.js @@ -52,6 +52,29 @@ if ($.blockUI) { } +/** + * Remove the "accesskey" attributes to avoid the use of the access keys + * while the blockUI is enable. + */ + +function blockAccessKeys() { + var elementWithAccessKey = []; + elementWithAccessKey = document.querySelectorAll('[accesskey]'); + _.each(elementWithAccessKey, function (elem) { + elem.setAttribute("data-accesskey",elem.getAttribute('accesskey')); + elem.removeAttribute('accesskey'); + }); +} + +function unblockAccessKeys() { + var elementWithDataAccessKey = []; + elementWithDataAccessKey = document.querySelectorAll('[data-accesskey]'); + _.each(elementWithDataAccessKey, function (elem) { + elem.setAttribute('accesskey', elem.getAttribute('data-accesskey')); + elem.removeAttribute('data-accesskey'); + }); +} + var throbbers = []; function blockUI() { @@ -60,6 +83,7 @@ function blockUI() { throbbers.push(throbber); throbber.appendTo($(".oe_blockui_spin_container")); $(document.body).addClass('o_ui_blocked'); + blockAccessKeys(); return tmp; } @@ -67,6 +91,7 @@ function unblockUI() { _.invoke(throbbers, 'destroy'); throbbers = []; $(document.body).removeClass('o_ui_blocked'); + unblockAccessKeys(); return $.unblockUI.apply($, arguments); } -- cgit v1.2.3 From 818c18e55d0718286ff5bf332186a10f4d7a58ef Mon Sep 17 00:00:00 2001 From: len-odoo Date: Tue, 24 Jul 2018 15:26:41 +0200 Subject: [FIX] web: fix js data during consecutive sequence of resequence moves Let x_1, ..., x_a, x_{a+1}, ..., x_{a+k}, x_{a+k+1}, ..., x_{n} be a record sequence ordered by its 'sequence' field. Suppose the reordering occurs between elements x_{a+k} and x_{a+1}. If the subsequence x_1, ..., x_a is ordered, then it does not change. This is also true of the subsequence x_{a+k+1}, ..., x_{n}. The resquence function makes exactly this assumption, and only sends the server the subsequence x_{a+1}, ..., x_{a+k} to update its 'sequence' field. The update of x is done as follows: it is index + offset, where index is the position of x in the subsequence, and offset is the 'sequence' of the first element of the sequence (i.e. x_{a+1}.sequence). It is easy to see that we need another hypothesis: that the sequence numbers are unique. To show it, suppose that the sequence of x_1, ..., x_a is 0, then all x_{a+1}, ..., x_{a+k} have sequence 1, and lastly all x_{a+k}, x_{a+k+1}, ..., x_{n} have sequence 2. Then after the call to the server resequence, the subsequence x_{a+1}, ..., x_{a+k} would have sequence numbers 1, 2,..., k. Since the x_{a+k+1}, ..., x_{n} subsequence have 'sequence' value 1, this would obviously be incorrect. We fix the reordering of the data in the js frontend to be consistent with what is done by the server. Note that this is only pertinent for sequences of reordering moves, since otherwise the data comes directly from the server. opw 1867049 --- addons/web/static/src/js/views/basic/basic_model.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/views/basic/basic_model.js b/addons/web/static/src/js/views/basic/basic_model.js index 7621fe35446..16f77b7954c 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -894,8 +894,14 @@ var BasicModel = AbstractModel.extend({ params: params, }) .then(function () { + var offset = options.offset ? options.offset : 0; + var old_data = data.data.slice(); data.data = _.sortBy(data.data, function (d) { - return _.indexOf(resIDs, self.localData[d].res_id); + if (_.contains(resIDs, self.localData[d].res_id)) { + return _.indexOf(resIDs, self.localData[d].res_id) + offset; + } else { + return _.indexOf(old_data, d); + } }); data.res_ids = []; _.each(data.data, function (d) { -- cgit v1.2.3 From 3c9aa50449681efc5b4bcc680a6200c964d45804 Mon Sep 17 00:00:00 2001 From: Dipalee Bhalodia Date: Thu, 28 Jun 2018 18:21:11 +0530 Subject: [FIX] web: Graph: group by two fields on line chart Before this commit, when we applied two or more groupbys in line graph, the groups displayed on the X axis where shifted to the left, and the first one wasn't displayed at all. related task: #1848289 Closes: #25037 --- addons/web/static/src/js/views/graph/graph_renderer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/views/graph/graph_renderer.js b/addons/web/static/src/js/views/graph/graph_renderer.js index 58ce4b2fc39..2b193bbdccb 100644 --- a/addons/web/static/src/js/views/graph/graph_renderer.js +++ b/addons/web/static/src/js/views/graph/graph_renderer.js @@ -313,7 +313,7 @@ return AbstractRenderer.extend({ }; } data_dict[serie].values.push({ - x: tick, y: this.state.data[i].value, + x: tick - 1, y: this.state.data[i].value, }); data = _.map(data_dict, identity); } -- cgit v1.2.3