diff --git a/addons/hr_attendance/__openerp__.py b/addons/hr_attendance/__openerp__.py
index c903a87abc4..b25047638c8 100644
--- a/addons/hr_attendance/__openerp__.py
+++ b/addons/hr_attendance/__openerp__.py
@@ -54,5 +54,9 @@ actions(Sign in/Sign out) performed by them.
'installable': True,
'auto_install': False,
'certificate': '0063495605613',
+
+ #web
+ "js": ["static/src/js/sign_in_out.js"],
+ 'qweb' : ["static/src/xml/sign_in_out.xml"],
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/hr_attendance/static/src/img/emp-in-disable.png b/addons/hr_attendance/static/src/img/emp-in-disable.png
new file mode 100644
index 00000000000..1968e0de464
Binary files /dev/null and b/addons/hr_attendance/static/src/img/emp-in-disable.png differ
diff --git a/addons/hr_attendance/static/src/img/emp-in.png b/addons/hr_attendance/static/src/img/emp-in.png
new file mode 100644
index 00000000000..26e3c01556b
Binary files /dev/null and b/addons/hr_attendance/static/src/img/emp-in.png differ
diff --git a/addons/hr_attendance/static/src/img/emp-out-disable.png b/addons/hr_attendance/static/src/img/emp-out-disable.png
new file mode 100644
index 00000000000..b7099e44529
Binary files /dev/null and b/addons/hr_attendance/static/src/img/emp-out-disable.png differ
diff --git a/addons/hr_attendance/static/src/img/emp-out.png b/addons/hr_attendance/static/src/img/emp-out.png
new file mode 100644
index 00000000000..d2a6cbb5013
Binary files /dev/null and b/addons/hr_attendance/static/src/img/emp-out.png differ
diff --git a/addons/hr_attendance/static/src/img/icon.png b/addons/hr_attendance/static/src/img/icon.png
new file mode 100644
index 00000000000..297dc71c85c
Binary files /dev/null and b/addons/hr_attendance/static/src/img/icon.png differ
diff --git a/addons/hr_attendance/static/src/js/sign_in_out.js b/addons/hr_attendance/static/src/js/sign_in_out.js
new file mode 100644
index 00000000000..0a0174d0a89
--- /dev/null
+++ b/addons/hr_attendance/static/src/js/sign_in_out.js
@@ -0,0 +1,82 @@
+openerp.hr_attendance = function(openerp) {
+
+ openerp.hr_attendance.SignIn = openerp.web.Widget.extend({
+ template: 'SignInNotifier',
+ start: function() {
+ this.$element.on('click', '.sign_in', this.getParent().on_sign_in_out);
+ }
+ });
+
+ openerp.hr_attendance.SignOut = openerp.web.Widget.extend({
+ template: 'SignOutNotifier',
+
+ start: function() {
+ this.$element.on('click', '.sign_out', this.getParent().on_sign_in_out);
+ }
+ });
+
+ openerp.hr_attendance.SignInOut = openerp.web.Widget.extend({
+ template: "SignInOutNotifier",
+ init: function() {
+ this._super.apply(this, arguments);
+ this.dataset = new openerp.web.DataSetSearch(
+ this,
+ 'hr.employee',
+ this.session.user_context,
+ [['user_id','=', this.session.uid]]);
+ },
+
+ start: function() {
+ return this.dataset.read_slice(['state']).done(this.do_sign_in_out);
+ },
+
+ do_sign_in_out: function(user) {
+ if(_.isEmpty(user)) return;
+ if(user[0]['state'] === 'present') {
+ this.sign_out = new openerp.hr_attendance.SignOut(this);
+ this.sign_out.appendTo(this.$element);
+ } else {
+ this.sign_in = new openerp.hr_attendance.SignIn(this);
+ this.sign_in.appendTo(this.$element);
+ }
+ },
+
+ on_sign_in_out: function(evt) {
+ var self = this;
+ new openerp.web.DataSetSearch(
+ this,
+ 'ir.actions.act_window',
+ {},
+ [['res_model', '=', 'hr.sign.in.out']])
+ .read_slice().done(function(action) {
+ action = action[0];
+ action.context = JSON.parse(action.context);
+ var action_manager = new openerp.web.ActionManager(self);
+ action_manager.do_action(action, self.on_close);
+ });
+ },
+
+ on_close: function() {
+ if(this.sign_in) {
+ this.sign_in.destroy();
+ this.sign_out = new openerp.hr_attendance.SignOut(this);
+ this.sign_out.appendTo(this.$element);
+ } else if(this.sign_out) {
+ this.sign_out.destroy();
+ this.sign_in = new openerp.hr_attendance.SignIn(this);
+ this.sign_in.appendTo(this.$element);
+ }
+ }
+ });
+
+ openerp.web.UserMenu.include({
+ do_update: function() {
+ var self = this;
+ this._super();
+ this.update_promise.then(function() {
+ self.hr_sign_in_out = new openerp.hr_attendance.SignInOut(self);
+ self.hr_sign_in_out.appendTo(openerp.webclient.$element.find('.oe_systray'))
+ });
+ }
+ });
+}
diff --git a/addons/hr_attendance/static/src/xml/sign_in_out.xml b/addons/hr_attendance/static/src/xml/sign_in_out.xml
new file mode 100644
index 00000000000..e28b93dfa6c
--- /dev/null
+++ b/addons/hr_attendance/static/src/xml/sign_in_out.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/addons/hr_attendance/wizard/hr_attendance_sign_in_out.py b/addons/hr_attendance/wizard/hr_attendance_sign_in_out.py
index 55edb1406e8..15e8783d660 100644
--- a/addons/hr_attendance/wizard/hr_attendance_sign_in_out.py
+++ b/addons/hr_attendance/wizard/hr_attendance_sign_in_out.py
@@ -69,6 +69,7 @@ class hr_sign_in_out(osv.osv_memory):
_columns = {
'name': fields.char('Employees name', size=32, required=True, readonly=True),
'state': fields.char('Current state', size=32, required=True, readonly=True),
+ 'date': fields.datetime('Date'),
'emp_id': fields.many2one('hr.employee', 'Empoyee ID', readonly=True),
}
diff --git a/addons/hr_attendance/wizard/hr_attendance_sign_in_out_view.xml b/addons/hr_attendance/wizard/hr_attendance_sign_in_out_view.xml
index 5121a2d18a0..b729dd85e5b 100644
--- a/addons/hr_attendance/wizard/hr_attendance_sign_in_out_view.xml
+++ b/addons/hr_attendance/wizard/hr_attendance_sign_in_out_view.xml
@@ -10,15 +10,16 @@
-
-
-
+
+
+
+
-
-
+
+