From e95b4e959433db45bc5c227f67763cd509fee333 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Mon, 7 Jan 2019 09:25:12 +0000 Subject: [FIX] web: graph view translation The control labels 'Grouped' and 'Stacked' are not translated since they are default values from nvd3. opw-1908220 closes odoo/odoo#29975 --- addons/web/static/src/js/views/graph/graph_renderer.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'addons/web/static/src/js') 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 5deba9d69bd..5ec89635dc8 100644 --- a/addons/web/static/src/js/views/graph/graph_renderer.js +++ b/addons/web/static/src/js/views/graph/graph_renderer.js @@ -210,6 +210,10 @@ return AbstractRenderer.extend({ margin: {left: 80, bottom: 100, top: 80, right: 0}, delay: 100, transition: 10, + controlLabels: { + 'grouped': _t('Grouped'), + 'stacked': _t('Stacked'), + }, showLegend: _.size(data) <= MAX_LEGEND_LENGTH, showXAxis: true, showYAxis: true, -- cgit v1.2.3 From 69f6b9510db36570698e472f797ef5e4e3685d2e Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 8 Jan 2019 13:15:16 +0000 Subject: [FIX] web: decimal separator of percentage When a percentage if formatted, the decimal separator used is always `.`, while it should be the decimal separator of the language. opw-1908220 closes odoo/odoo#30030 --- addons/web/static/src/js/fields/field_utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/web/static/src/js') diff --git a/addons/web/static/src/js/fields/field_utils.js b/addons/web/static/src/js/fields/field_utils.js index bbdee83c4f9..ec99f4fa0f6 100644 --- a/addons/web/static/src/js/fields/field_utils.js +++ b/addons/web/static/src/js/fields/field_utils.js @@ -363,7 +363,7 @@ function formatPercentage(value, field, options) { if (options.humanReadable && options.humanReadable(value * 100)) { return result + "%"; } - return parseFloat(result) + "%"; + return (parseFloat(result) + "%").replace('.', _t.database.parameters.decimal_point); } /** * Returns a string representing the value of the selection. -- cgit v1.2.3 From 07befd19a7b9ffb4b8174502c124bb5e97112fa8 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Mon, 7 Jan 2019 13:06:38 +0000 Subject: [FIX] web: make pie chart title translatable The Pie Chart title is not translatable, since a string defined in a `t-att-` cannot be translated. We use the attribute `title` instead. Tests are adapted in https://github.com/odoo/enterprise/pull/3379 opw-1908220 closes odoo/odoo#29991 --- addons/web/static/src/js/widgets/pie_chart.js | 1 + 1 file changed, 1 insertion(+) (limited to 'addons/web/static/src/js') diff --git a/addons/web/static/src/js/widgets/pie_chart.js b/addons/web/static/src/js/widgets/pie_chart.js index 663e2b4cc98..c483c23c73d 100644 --- a/addons/web/static/src/js/widgets/pie_chart.js +++ b/addons/web/static/src/js/widgets/pie_chart.js @@ -31,6 +31,7 @@ var PieChart = Widget.extend({ Domain.prototype.stringToArray(modifiers.domain || '[]')); var arch = qweb.render('web.PieChart', { modifiers: modifiers, + title: node.attrs.title || modifiers.title || modifiers.measure, }); this.subViewParams = { -- cgit v1.2.3 From ccb2fffc6556ffbc940d4a92c89bf06bec1656cd Mon Sep 17 00:00:00 2001 From: Priyanka Kakadiya Date: Fri, 23 Nov 2018 06:42:05 +0000 Subject: [FIX] web: prevent crash in kanban in some cases Before this commit, if a user tries to group a kanban view by a date or a datetime interval, then tries to drag and drop a record from one column to another, then the web client crashes. This is actually an invalid operation, and is supposed to be disallowed. There is already some code that properly handle the situation. However, the field attribute was not properly read in the case of fields of type date/datetime. Related to Issue: #1911975 Co-authored-by: Mohammed Shekha closes odoo/odoo#30029 --- addons/web/static/src/js/views/kanban/kanban_renderer.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'addons/web/static/src/js') diff --git a/addons/web/static/src/js/views/kanban/kanban_renderer.js b/addons/web/static/src/js/views/kanban/kanban_renderer.js index 3dc0cae5540..3e17c65ef66 100644 --- a/addons/web/static/src/js/views/kanban/kanban_renderer.js +++ b/addons/web/static/src/js/views/kanban/kanban_renderer.js @@ -436,7 +436,8 @@ var KanbanRenderer = BasicRenderer.extend({ _setState: function (state) { this.state = state; - var groupByField = state.groupedBy[0]; + // split groupedBy field with ':' as it can be date/datetime field + var groupByField = state.groupedBy.length && state.groupedBy[0].split(":")[0]; var groupByFieldAttrs = state.fields[groupByField]; var groupByFieldInfo = state.fieldsInfo.kanban[groupByField]; // Deactivate the drag'n'drop if the groupedBy field: -- cgit v1.2.3