From 625e2f06be2582b6f8d983d7e25a6c8f73102424 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 6 Aug 2019 13:14:32 +0000 Subject: [FIX] web: kanban swipe in RTL - Set a language using RTL (e.g. Arabic) - Activate mobile mode (through debug mode or on a mobile device) - Go to a grouped kanban view (e.g. CRM pipeline) - Swipe to the left The column to the left if shown instead of the column to the right. In RTL, the kanban groups order are inverted. Therefore, we also need to invert the swipe direction. --- addons/web/static/src/js/views/kanban/kanban_renderer_mobile.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/views/kanban/kanban_renderer_mobile.js b/addons/web/static/src/js/views/kanban/kanban_renderer_mobile.js index 8619448e793..3961805c41e 100644 --- a/addons/web/static/src/js/views/kanban/kanban_renderer_mobile.js +++ b/addons/web/static/src/js/views/kanban/kanban_renderer_mobile.js @@ -112,12 +112,13 @@ KanbanRenderer.include({ _enableSwipe: function () { var self = this; var currentColumn = this.widgets[this.activeColumnIndex]; + var step = _t.database.parameters.direction === 'rtl' ? -1 : 1; currentColumn.$el.swipe({ swipeLeft: function () { - self._moveToGroup(self.activeColumnIndex + 1, self.ANIMATE); + self._moveToGroup(self.activeColumnIndex + step, self.ANIMATE); }, swipeRight: function () { - self._moveToGroup(self.activeColumnIndex - 1, self.ANIMATE); + self._moveToGroup(self.activeColumnIndex - step, self.ANIMATE); } }); }, -- cgit v1.2.3 From 868bad0259922902a3276b0c4cf141efaadb206b Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 6 Aug 2019 14:01:23 +0000 Subject: [FIX] web: quick create in RTL - Set a language using RTL (e.g. Arabic) - Activate mobile mode (through debug mode or on a mobile device) - Go to the CRM kanban view (make sure no record exist so the no_content message is displayed) - Add a new record - Fill in the name, click outside of the field The no_content message is displayed over the form view and it is impossible to save the record. The root cause is the incorrect structure of the kanban view page in RTL, leading the user to the wrong element and triggering the wrong event. We make the structure of the view aware of the RTL configuration. opw-2046231 closes odoo/odoo#35509 Signed-off-by: Nicolas Martinelli (nim) Co-authored-by: Mohammed Shekha --- .../src/js/views/kanban/kanban_renderer_mobile.js | 37 +++++++++++++++------- 1 file changed, 26 insertions(+), 11 deletions(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/views/kanban/kanban_renderer_mobile.js b/addons/web/static/src/js/views/kanban/kanban_renderer_mobile.js index 3961805c41e..7160cca12fb 100644 --- a/addons/web/static/src/js/views/kanban/kanban_renderer_mobile.js +++ b/addons/web/static/src/js/views/kanban/kanban_renderer_mobile.js @@ -90,10 +90,15 @@ KanbanRenderer.include({ var index = _.findIndex(this.widgets, {db_id: localID}); var $column = this.widgets[index].$el; var left = $column.css('left'); + var right = $column.css('right'); var scrollTop = $column.scrollTop(); return this._super.apply(this, arguments).then(function () { $column = self.widgets[index].$el; - $column.css({left: left}); + if (_t.database.parameters.direction === 'rtl') { + $column.css({right: right}); + } else { + $column.css({left: left}); + } $column.scrollTop(scrollTop); // required when clicking on 'Load More' self._enableSwipe(); }); @@ -149,22 +154,32 @@ KanbanRenderer.include({ var columnID = column.id || column.db_id; var $column = self.$('.o_kanban_group[data-id="' + columnID + '"]'); var $tab = self.$('.o_kanban_mobile_tab[data-id="' + columnID + '"]'); + var colPosition, tabPosition; if (index === moveToIndex - 1) { - $column[updateFunc]({left: '-100%'}); - $tab[updateFunc]({left: '0%'}); + colPosition = '-100%'; + tabPosition = '0%'; } else if (index === moveToIndex + 1) { - $column[updateFunc]({left: '100%'}); - $tab[updateFunc]({left: '100%'}); + colPosition = '100%'; + tabPosition = '100%'; } else if (index === moveToIndex) { - $column[updateFunc]({left: '0%'}); - $tab[updateFunc]({left: '50%'}); + colPosition = '0%'; + tabPosition = '50%'; $tab.addClass('o_current'); } else if (index < moveToIndex) { - $column.css({left: '-100%'}); - $tab[updateFunc]({left: '-100%'}); + colPosition = '-100%'; + tabPosition = '-100%'; } else if (index > moveToIndex) { - $column.css({left: '100%'}); - $tab[updateFunc]({left: '200%'}); + colPosition = '100%'; + tabPosition = '200%'; + } else { + return; + } + if (_t.database.parameters.direction === 'rtl') { + $column[updateFunc]({right: colPosition}); + $tab[updateFunc]({right: tabPosition}); + } else { + $column[updateFunc]({left: colPosition}); + $tab[updateFunc]({left: tabPosition}); } }); def.resolve(); -- cgit v1.2.3 From fde3b696562a12dc3ec99fcb85004a6a40e040f0 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 7 Aug 2019 07:28:57 +0000 Subject: [FIX] tools: epsilon magnitude MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The following rounding is incorrect: ``` >>> float_round(6.6 * 0.175, precision_digits=2) 1.15 ``` Indeed, 6.6 * 0.175 = 1.155 ≈ 1.16. In this specific case, the `epsilon` computed is not sufficient. A precision of 53 gives: normalized_value = 115.49999999999997 epsilon = 1.2823075934420547e-14 => new normalized_value = 115.49999999999999 Bad luck, this is just not enough to tip the value in the right direction. However, a precision of 52 is sufficient: normalized_value = 115.49999999999997 epsilon = 2.5646151868841094e-14 => new normalized_value = 115.5 The value of 53 was chosen from the `binary64` number format precision. In case of Python, the corresponding machine epsilon is 2^-52 [1]. Therefore, using 52 instead of 53 does make sense. It is worth noting that the value of the machine epsilon 2^-52 = 2.2204460492503131e-16, which is still 2 orders of magnitude below our dynamic estimation. [1] https://en.wikipedia.org/wiki/Machine_epsilon [2] `numpy.finfo(float).eps = 2.2204460492503131e-16` opw-2047368 closes odoo/odoo#35521 Signed-off-by: Nicolas Martinelli (nim) --- addons/web/static/src/js/core/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/core/utils.js b/addons/web/static/src/js/core/utils.js index a21c4241864..231ad97d202 100644 --- a/addons/web/static/src/js/core/utils.js +++ b/addons/web/static/src/js/core/utils.js @@ -309,7 +309,7 @@ var utils = { } var normalized_value = value / precision; var epsilon_magnitude = Math.log(Math.abs(normalized_value))/Math.log(2); - var epsilon = Math.pow(2, epsilon_magnitude - 53); + var epsilon = Math.pow(2, epsilon_magnitude - 52); normalized_value += normalized_value >= 0 ? epsilon : -epsilon; /** -- cgit v1.2.3 From cb3c2e64c367c5b46bb8d4e253473c162e4dbaca Mon Sep 17 00:00:00 2001 From: Jorge Pinna Puissant Date: Mon, 12 Aug 2019 08:39:07 +0000 Subject: [FIX] partner_autocomplete, web: autocomplete error when suggested company has a country - Change the company's country to Finland; - Go to Contacts and click on Create; - Tick the Company box above the Name field; - Start typing into the Name field; - Click on a company with a VAT number under its name. Before this commit, a Traceback appears. This occurs because the response of the request with the suggested company has the fields 'company_name' and 'company_code' and these fields are not in res_partner. Now, the suggested company is parsed to correctly field the country field. opw-2049636 closes odoo/odoo#35631 Signed-off-by: Simon Goffin (sig) --- addons/web/static/src/js/views/basic/basic_model.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (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 ce4f01ab467..70fae723866 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -1456,9 +1456,9 @@ var BasicModel = AbstractModel.extend({ // apply changes to local data for (var fieldName in changes) { field = record.fields[fieldName]; - if (field.type === 'one2many' || field.type === 'many2many') { + if (field && (field.type === 'one2many' || field.type === 'many2many')) { defs.push(this._applyX2ManyChange(record, fieldName, changes[fieldName], options.viewType, options.allowWarning)); - } else if (field.type === 'many2one' || field.type === 'reference') { + } else if (field && (field.type === 'many2one' || field.type === 'reference')) { defs.push(this._applyX2OneChange(record, fieldName, changes[fieldName])); } else { record._changes[fieldName] = changes[fieldName]; @@ -1473,7 +1473,7 @@ var BasicModel = AbstractModel.extend({ var onChangeFields = []; // the fields that have changed and that have an on_change for (var fieldName in changes) { field = record.fields[fieldName]; - if (field.onChange) { + if (field && field.onChange) { var isX2Many = field.type === 'one2many' || field.type === 'many2many'; if (!isX2Many || (self._isX2ManyValid(record._changes[fieldName] || record.data[fieldName]))) { onChangeFields.push(fieldName); -- cgit v1.2.3 From cf318ad90c98a67b0e7d0d69839410463a7e189b Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Wed, 14 Aug 2019 09:29:10 +0000 Subject: [FIX] web: list: tweak columns weight --- .../web/static/src/js/views/list/list_editable_renderer.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/js/views/list/list_editable_renderer.js b/addons/web/static/src/js/views/list/list_editable_renderer.js index 2203c1c4151..fa2f8e6031f 100644 --- a/addons/web/static/src/js/views/list/list_editable_renderer.js +++ b/addons/web/static/src/js/views/list/list_editable_renderer.js @@ -502,16 +502,16 @@ ListRenderer.include({ switch (field.type) { case 'binary': return 1; case 'boolean': return '40px'; - case 'char': return 1; - case 'date': return '100px'; - case 'datetime': return '150px'; - case 'float': return '100px'; + case 'char': return 2; + case 'date': return '92px'; + case 'datetime': return '146px'; + case 'float': return '92px'; case 'html': return 3; - case 'integer': return '80px'; + case 'integer': return '74px'; case 'many2many': return 2; case 'many2one': return 2; - case 'monetary': return 1.2; - case 'one2many': return 2.5; + case 'monetary': return '104px'; + case 'one2many': return 2; case 'reference': return 1.5; case 'selection': return 1.5; case 'text': return 2.5; -- cgit v1.2.3 From a32aa05a6bc912d53e0bfe3ef0946009c2a28f2a Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Tue, 13 Aug 2019 08:14:03 +0000 Subject: [FIX] web: list: break words in text fields closes odoo/odoo#35713 Signed-off-by: Julien Mougenot (JUM) --- addons/web/static/src/scss/list_view.scss | 3 +++ 1 file changed, 3 insertions(+) (limited to 'addons/web/static/src') diff --git a/addons/web/static/src/scss/list_view.scss b/addons/web/static/src/scss/list_view.scss index ab3707e6ddf..4fa74da4be2 100644 --- a/addons/web/static/src/scss/list_view.scss +++ b/addons/web/static/src/scss/list_view.scss @@ -35,6 +35,9 @@ &.o_list_many2one { white-space: pre-wrap; } + &.o_list_text { + word-break: break-word; + } } tfoot { -- cgit v1.2.3