From 6207ab27bf26976d1bcb4c8918953c3cf6586a97 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 6 Sep 2012 12:18:52 +0200 Subject: [PATCH] removed lot of stupid stuff bzr revid: nicolas.vanhoren@openerp.com-20120906101852-xf3pkjjdnl4x7xnn --- .../hr_attendance/static/src/js/attendance.js | 48 ++----------------- .../static/src/xml/attendance.xml | 4 +- 2 files changed, 5 insertions(+), 47 deletions(-) diff --git a/addons/hr_attendance/static/src/js/attendance.js b/addons/hr_attendance/static/src/js/attendance.js index 58d49540857..197f85f6d92 100644 --- a/addons/hr_attendance/static/src/js/attendance.js +++ b/addons/hr_attendance/static/src/js/attendance.js @@ -2,8 +2,6 @@ openerp.hr_attendance = function(instance) { var QWeb = instance.web.qweb; _t = instance.web._t; - instance.web.currentform = false; - instance.web.currentlist = false; instance.web.attendanceslider = false; instance.hr_attendance.AttendanceSlider = instance.web.Widget.extend({ @@ -16,9 +14,7 @@ openerp.hr_attendance = function(instance) { this.session = parent.session; this.parent_element = parent.$el ; }, - renderElement: function(){ - this.$el = $(QWeb.render(this.template,this.titles)); - this.parent_element.prepend(this.$el); + start: function() { this.$oe_attendance_slider = this.$el.find(".oe_attendance_slider"); this.$oe_attendance_slider.click(this.do_update_attendance); }, @@ -33,20 +29,6 @@ openerp.hr_attendance = function(instance) { else self.employee.state = 'present'; self.do_slide(self.employee.state); - if(instance.web.currentlist){ - instance.web.currentlist.reload(); - } - if(instance.web.currentform){ - //tofix: it should be in hr_timesheet_sheet module - if (instance.web.currentform.model == 'hr_timesheet_sheet.sheet'){ - model = new instance.web.DataSet(self, instance.web.currentform.model); - model.call('date_today', [instance.web.currentform.dataset.ids]).done(function(result){instance.web.currentform.reload();}); - } - else{ - instance.web.currentform.reload(); - } - - } }); }, do_slide:function(attendance_state) @@ -73,38 +55,14 @@ openerp.hr_attendance = function(instance) { }, }); - instance.web.ListView.include({ - init:function(parent, dataset, view_id, options) - { - this._super(parent, dataset, view_id, options); - if (this.model == 'hr.employee' || this.model == 'hr.attendance' || this.model == 'hr_timesheet_sheet.sheet') - instance.web.currentlist = this; - } - }); - - - instance.web.FormView.include({ - init: function(parent, dataset, view_id, options) { - this._super(parent, dataset, view_id, options); - if (this.model == 'hr.employee' || this.model == 'hr.attendance' || this.model == 'hr_timesheet_sheet.sheet') - instance.web.currentform = this; - }, - reload: function(){ - var re = this._super(); - if (!instance.web.attendanceslider) return re; - if (this.model == 'hr.employee' || this.model == 'hr.attendance' || this.model == 'hr_timesheet_sheet.sheet') - instance.web.attendanceslider.check_attendance(); - return re; - }, - }), - instance.web.UserMenu.include({ do_update: function () { this._super(); var self = this; var fct = function() { instance.web.attendanceslider = new instance.hr_attendance.AttendanceSlider(self); - instance.web.attendanceslider.renderElement(); + + instance.web.attendanceslider.prependTo(self.$el); return instance.web.attendanceslider.check_attendance(); }; this.update_promise = this.update_promise.pipe(fct, fct); diff --git a/addons/hr_attendance/static/src/xml/attendance.xml b/addons/hr_attendance/static/src/xml/attendance.xml index 5670545e26c..aadfe0155e0 100644 --- a/addons/hr_attendance/static/src/xml/attendance.xml +++ b/addons/hr_attendance/static/src/xml/attendance.xml @@ -3,8 +3,8 @@
  • -
    -
    +
    +
    slider