summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorRomainLibert <rli@odoo.com>2018-01-12 14:37:09 +0100
committerRomainLibert <rli@odoo.com>2018-01-15 10:23:13 +0100
commitae58fd5bd31cd02b287d5c64758eb52a0536a000 (patch)
treeaa36e19db27e8a20bd40c747ef1dc28a79cfb5cf /addons/web/static/src
parente5330857b71907199737ee387de3f39adaaab690 (diff)
[IMP] WEB: Progressbar Subgroup count in Sumfield
The idea is that when we click on either the green, orange or red part of the progressbar the count on it's right changes to whatever the value of filtered records should be.
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/views/kanban/kanban_column_progressbar.js26
1 files changed, 25 insertions, 1 deletions
diff --git a/addons/web/static/src/js/views/kanban/kanban_column_progressbar.js b/addons/web/static/src/js/views/kanban/kanban_column_progressbar.js
index 7e4f2cd96a8..fad822efdb9 100644
--- a/addons/web/static/src/js/views/kanban/kanban_column_progressbar.js
+++ b/addons/web/static/src/js/views/kanban/kanban_column_progressbar.js
@@ -30,6 +30,7 @@ var KanbanColumnProgressBar = Widget.extend({
this.fieldName = columnState.progressBarValues.field;
this.colors = columnState.progressBarValues.colors;
this.sumField = columnState.progressBarValues.sum_field;
+ this.progressBarHelp = columnState.progressBarValues.help;
// Previous progressBar state
var state = options.progressBarStates[this.columnID];
@@ -130,6 +131,14 @@ var KanbanColumnProgressBar = Widget.extend({
}
},
});
+ if (this.progressBarHelp && _.every(this.subgroupCounts, function (val) { return val === 0; })) {
+ this.$el.tooltip({
+ delay: '0',
+ trigger:'hover',
+ placement: 'top',
+ title: this.progressBarHelp,
+ });
+ }
// Display and animate the progress bars
_.each(self.colors, function (val, key) {
@@ -165,9 +174,24 @@ var KanbanColumnProgressBar = Widget.extend({
// Display and animate the counter number
var start = this.prevTotalCounterValue;
var end = this.totalCounterValue;
+
+ if (this.activeFilter) {
+ if (this.sumField) {
+ end = 0;
+ _.each(self.columnState.data, function (record) {
+ var recordData = record.data;
+ if (self.activeFilter === recordData[self.fieldName]) {
+ end += parseFloat(recordData[self.sumField]);
+ }
+ });
+ } else {
+ end = this.subgroupCounts[this.activeFilter];
+ }
+ }
+ this.prevTotalCounterValue = end;
var animationClass = start > 999 ? 'o_kanban_grow' : 'o_kanban_grow_huge';
- if (start !== undefined && end > start && this.ANIMATE) {
+ if (start !== undefined && (end > start || this.activeFilter) && this.ANIMATE) {
$({currentValue: start}).animate({currentValue: end}, {
duration: 1000,
start: function () {