summaryrefslogtreecommitdiff
path: root/addons/hr_gamification/static/src
diff options
context:
space:
mode:
authorMartin Trigaux <mat@openerp.com>2013-04-12 17:21:50 +0200
committerMartin Trigaux <mat@openerp.com>2013-04-12 17:21:50 +0200
commitb18bc579197837ddcc97d9f7292d8cec3bc05d49 (patch)
tree4575c872d76e90d575b00da3b47ad50e4c96dff2 /addons/hr_gamification/static/src
parent8f05129bcda7de790b33b561330dcd881f5c8da2 (diff)
[ADD] use sparklines
bzr revid: mat@openerp.com-20130412152150-8679huigt6cfmool
Diffstat (limited to 'addons/hr_gamification/static/src')
-rw-r--r--addons/hr_gamification/static/src/js/badges.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/addons/hr_gamification/static/src/js/badges.js b/addons/hr_gamification/static/src/js/badges.js
new file mode 100644
index 00000000000..7506c65f144
--- /dev/null
+++ b/addons/hr_gamification/static/src/js/badges.js
@@ -0,0 +1,25 @@
+openerp.hr_gamification = function(instance) {
+ instance.web_kanban.KanbanRecord.include({
+ on_card_clicked: function() {
+ if (this.view.dataset.model === 'gamification.badge') {
+ if (this.record.stat_count.raw_value > 0) {
+ this.$('.oe_kanban_badge_avatars a').first().click();
+ } else {
+ return false;
+ }
+ } else if (this.view.dataset.model === 'gamification.badge.user') {
+ var action = {
+ type: 'ir.actions.act_window',
+ res_model: 'gamification.badge',
+ view_mode: 'form',
+ view_type: 'form,kanban,tree',
+ views: [[false, 'form']],
+ res_id: this.record.badge_id.raw_value[0]
+ };
+ this.do_action(action);
+ } else {
+ this._super.apply(this, arguments);
+ }
+ }
+ });
+};