diff --git a/addons/hr_attendance/__openerp__.py b/addons/hr_attendance/__openerp__.py
index 985c42e5a04..cb2cd261773 100644
--- a/addons/hr_attendance/__openerp__.py
+++ b/addons/hr_attendance/__openerp__.py
@@ -43,7 +43,6 @@ actions(Sign in/Sign out) performed by them.
'wizard/hr_attendance_bymonth_view.xml',
'wizard/hr_attendance_byweek_view.xml',
'wizard/hr_attendance_error_view.xml',
- 'wizard/hr_attendance_sign_in_out_view.xml',
],
'demo': ['hr_attendance_demo.xml'],
'test': [
@@ -53,5 +52,10 @@ actions(Sign in/Sign out) performed by them.
'installable': True,
'auto_install': False,
'certificate': '0063495605613',
+
+ #web
+ "js": ["static/src/js/attendance.js"],
+ 'qweb' : ["static/src/xml/attendance.xml"],
+ 'css' : ["static/src/css/slider.css"],
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/hr_attendance/hr_attendance.py b/addons/hr_attendance/hr_attendance.py
index 7a0cc7a8e51..ae05a6143fd 100644
--- a/addons/hr_attendance/hr_attendance.py
+++ b/addons/hr_attendance/hr_attendance.py
@@ -122,30 +122,25 @@ class hr_employee(osv.osv):
res = cr.fetchone()
return not (res and (res[0]>=(dt or time.strftime('%Y-%m-%d %H:%M:%S'))))
- def attendance_action_change(self, cr, uid, ids, type='action', context=None, dt=False, *args):
- obj_attendance = self.pool.get('hr.attendance')
- id = False
- warning_sign = 'sign'
- res = {}
+ def attendance_action_change(self, cr, uid, ids, context=None):
+ if context is None:
+ context = {}
+ action_date = context.get('action_date', False)
+ action = context.get('action', False)
+ hr_attendance = self.pool.get('hr.attendance')
+ warning_sign = {'sign_in': _('Sign In'), 'sign_out': _('Sign Out')}
+ for employee in self.browse(cr, uid, ids, context=context):
+ if not action:
+ if employee.state == 'present': action = 'sign_out'
+ if employee.state == 'absent': action = 'sign_in'
- #Special case when button calls this method: type=context
- if isinstance(type, dict):
- type = type.get('type','action')
- if type == 'sign_in':
- warning_sign = "Sign In"
- elif type == 'sign_out':
- warning_sign = "Sign Out"
- for emp in self.read(cr, uid, ids, ['id'], context=context):
- if not self._action_check(cr, uid, emp['id'], dt, context):
- raise osv.except_osv(_('Warning!'), _('You tried to %s with a date anterior to another event !\nTry to contact the administrator to correct attendances.')%(warning_sign,))
+ if not self._action_check(cr, uid, employee.id, action_date, context):
+ raise osv.except_osv(_('Warning'), _('You tried to %s with a date anterior to another event !\nTry to contact the HR Manager to correct attendances.')%(warning_sign[action],))
- res = {'action': type, 'employee_id': emp['id']}
- if dt:
- res['name'] = dt
- id = obj_attendance.create(cr, uid, res, context=context)
-
- if type != 'action':
- return id
+ vals = {'action': action, 'employee_id': employee.id}
+ if action_date:
+ vals['name'] = action_date
+ hr_attendance.create(cr, uid, vals, context=context)
return True
hr_employee()
diff --git a/addons/hr_attendance/hr_attendance_view.xml b/addons/hr_attendance/hr_attendance_view.xml
index 1d0122d55fa..097d7f32258 100644
--- a/addons/hr_attendance/hr_attendance_view.xml
+++ b/addons/hr_attendance/hr_attendance_view.xml
@@ -127,8 +127,8 @@
-
-
-
+
+
@@ -136,3 +136,5 @@
+
+
diff --git a/addons/hr_attendance/static/src/css/slider.css b/addons/hr_attendance/static/src/css/slider.css
new file mode 100644
index 00000000000..9e0252156b2
--- /dev/null
+++ b/addons/hr_attendance/static/src/css/slider.css
@@ -0,0 +1,27 @@
+
+.openerp .oe_attendance_status {
+ height: 32px;
+ width: 32px;
+ display: inline-block;
+}
+.openerp .oe_attendance_signin {
+ float:left;
+ height: 32px;
+ width: 32px;
+ background: url(/hr_attendance/static/src/img/emp-in32.png);
+ cursor: pointer;
+}
+.openerp .oe_attendance_status.oe_attendance_signed .oe_attendance_signin {
+ display: none;
+}
+
+.openerp .oe_attendance_signout {
+ float:right;
+ height: 32px;
+ width: 32px;
+ background: url(/hr_attendance/static/src/img/emp-out32.png);
+ cursor: pointer;
+}
+.openerp .oe_attendance_status.oe_attendance_nosigned .oe_attendance_signout {
+ display: none;
+}
diff --git a/addons/hr_attendance/static/src/img/emp-in-disable32.png b/addons/hr_attendance/static/src/img/emp-in-disable32.png
new file mode 100644
index 00000000000..1968e0de464
Binary files /dev/null and b/addons/hr_attendance/static/src/img/emp-in-disable32.png differ
diff --git a/addons/hr_attendance/static/src/img/emp-in32.png b/addons/hr_attendance/static/src/img/emp-in32.png
new file mode 100644
index 00000000000..26e3c01556b
Binary files /dev/null and b/addons/hr_attendance/static/src/img/emp-in32.png differ
diff --git a/addons/hr_attendance/static/src/img/emp-out-disable32.png b/addons/hr_attendance/static/src/img/emp-out-disable32.png
new file mode 100644
index 00000000000..b7099e44529
Binary files /dev/null and b/addons/hr_attendance/static/src/img/emp-out-disable32.png differ
diff --git a/addons/hr_attendance/static/src/img/emp-out32.png b/addons/hr_attendance/static/src/img/emp-out32.png
new file mode 100644
index 00000000000..d2a6cbb5013
Binary files /dev/null and b/addons/hr_attendance/static/src/img/emp-out32.png differ
diff --git a/addons/hr_attendance/static/src/js/attendance.js b/addons/hr_attendance/static/src/js/attendance.js
new file mode 100644
index 00000000000..f6a4c15268a
--- /dev/null
+++ b/addons/hr_attendance/static/src/js/attendance.js
@@ -0,0 +1,75 @@
+
+openerp.hr_attendance = function (instance) {
+
+ var QWeb = instance.web.qweb;
+ var _t = instance.web._t;
+ var _lt = instance.web._lt;
+
+ var tips = {
+ "true": _lt("You are currently signed in. Click here to sign out."),
+ "false": _lt("You are currently signed out. Click here to sign in."),
+ }
+
+ instance.hr_attendance.AttendanceSlider = instance.web.Widget.extend({
+ template: 'AttendanceSlider',
+ init: function (parent) {
+ this._super(parent);
+ this.set({"signed_in": false});
+ },
+ start: function() {
+ var self = this;
+ var tmp = function() {
+ this.$el.toggleClass("oe_attendance_nosigned", ! this.get("signed_in"));
+ this.$el.toggleClass("oe_attendance_signed", this.get("signed_in"));
+ this.$el.attr("title", tips["" + this.get("signed_in")].toString());
+ };
+ this.on("change:signed_in", this, tmp);
+ _.bind(tmp, this)();
+ this.$(".oe_attendance_signin").click(function() {
+ self.do_update_attendance();
+ });
+ this.$(".oe_attendance_signout").click(function() {
+ self.do_update_attendance();
+ });
+ return this.check_attendance();
+ },
+ do_update_attendance: function () {
+ var self = this;
+ var hr_employee = new instance.web.DataSet(self, 'hr.employee');
+ hr_employee.call('attendance_action_change', [
+ [self.employee.id]
+ ]).done(function (result) {
+ self.set({"signed_in": ! self.get("signed_in")});
+ });
+ },
+ check_attendance: function () {
+ var self = this;
+ self.employee = false;
+ this.$el.hide();
+ var employee = new instance.web.DataSetSearch(self, 'hr.employee', self.session.user_context, [
+ ['user_id', '=', self.session.uid]
+ ]);
+ return employee.read_slice(['id', 'name', 'state']).pipe(function (res) {
+ if (_.isEmpty(res))
+ return;
+ self.$el.show();
+ self.employee = res[0];
+ self.set({"signed_in": self.employee.state !== "absent"});
+ });
+ },
+ });
+
+ instance.web.UserMenu.include({
+ do_update: function () {
+ this._super();
+ var self = this;
+ this.update_promise = this.update_promise.then(function () {
+ if (self.attendanceslider)
+ return;
+ self.attendanceslider = new instance.hr_attendance.AttendanceSlider(self);
+
+ self.attendanceslider.prependTo(instance.webclient.$('.oe_systray'));
+ });
+ },
+ });
+}
diff --git a/addons/hr_attendance/static/src/xml/attendance.xml b/addons/hr_attendance/static/src/xml/attendance.xml
new file mode 100644
index 00000000000..6896086440f
--- /dev/null
+++ b/addons/hr_attendance/static/src/xml/attendance.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/hr_attendance/test/attendance_process.yml b/addons/hr_attendance/test/attendance_process.yml
index 4ad765d65df..7902bf11d9d 100644
--- a/addons/hr_attendance/test/attendance_process.yml
+++ b/addons/hr_attendance/test/attendance_process.yml
@@ -1,16 +1,8 @@
-
In order to test attendance process in OpenERP, I entry of SignIn of employee.
-
- !python {model: hr.sign.in.out}: |
- context.update({'emp_id': [ref('hr.employee_al')]}) #TOFIX: emp_ids instead of 'emp_id'
--
- !record {model: hr.sign.in.out, id: employee_sign_in}:
- {}
--
- Employee Signs In.
--
- !python {model: hr.sign.in.out}: |
- self.si_check(cr, uid, [ref("employee_sign_in")], context=context)
+ !python {model: hr.employee}: |
+ self.attendance_action_change(cr, uid, [ref("hr.employee_al")], context=context)
-
I check that Employee is "Present".
-
@@ -19,10 +11,10 @@
-
After few seconds, employee sign's out.
-
- !python {model: hr.sign.in.out}: |
+ !python {model: hr.employee}: |
import time
time.sleep(2)
- self.so_check(cr, uid, [ref("employee_sign_in")], context=context)
+ self.attendance_action_change(cr, uid, [ref("hr.employee_al")], context=context)
-
I check that Employee is "Absent".
-
diff --git a/addons/hr_attendance/wizard/__init__.py b/addons/hr_attendance/wizard/__init__.py
index a414c9a8798..6269c507d8c 100644
--- a/addons/hr_attendance/wizard/__init__.py
+++ b/addons/hr_attendance/wizard/__init__.py
@@ -19,9 +19,8 @@
#
##############################################################################
-import hr_attendance_sign_in_out
import hr_attendance_error
import hr_attendance_byweek
import hr_attendance_bymonth
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/hr_attendance/wizard/hr_attendance_sign_in_out.py b/addons/hr_attendance/wizard/hr_attendance_sign_in_out.py
deleted file mode 100644
index 0ad4323ad78..00000000000
--- a/addons/hr_attendance/wizard/hr_attendance_sign_in_out.py
+++ /dev/null
@@ -1,184 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL ().
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-##############################################################################
-import time
-
-from osv import osv, fields
-from tools.translate import _
-
-class hr_si_so_ask(osv.osv_memory):
- _name = 'hr.sign.in.out.ask'
- _description = 'Ask for Sign In Out'
- _columns = {
- 'name': fields.char('Employees name', size=32, required=True, readonly=True),
- 'last_time': fields.datetime('Your last sign out', required=True),
- 'emp_id': fields.many2one('hr.employee', 'Empoyee ID', readonly=True),
- }
-
- def _get_empname(self, cr, uid, context=None):
- emp_id = context.get('emp_id', self.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)], context=context))
- if emp_id:
- employee = self.pool.get('hr.employee').browse(cr, uid, emp_id, context=context)[0].name
- return employee
- return ''
-
- def _get_empid(self, cr, uid, context=None):
- emp_id = context.get('emp_id', self.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)], context=context))
- if emp_id:
- return emp_id[0]
- return False
-
- _defaults = {
- 'name': _get_empname,
- 'emp_id': _get_empid,
- }
-
- def sign_in(self, cr, uid, ids, context=None):
- data = self.read(cr, uid, ids, [], context=context)[0]
- data['emp_id'] = data['emp_id'] and data['emp_id'][0]
- return self.pool.get('hr.sign.in.out').sign_in(cr, uid, data, context)
-
- def sign_out(self, cr, uid, ids, context=None):
- data = self.read(cr, uid, ids, [], context=context)[0]
- data['emp_id'] = data['emp_id'] and data['emp_id'][0]
- return self.pool.get('hr.sign.in.out').sign_out(cr, uid, data, context)
-
-hr_si_so_ask()
-
-class hr_sign_in_out(osv.osv_memory):
- _name = 'hr.sign.in.out'
- _description = 'Sign In Sign Out'
-
- _columns = {
- 'name': fields.char('Employees name', size=32, required=True, readonly=True),
- 'state': fields.char('Current state', size=32, required=True, readonly=True),
- 'emp_id': fields.many2one('hr.employee', 'Empoyee ID', readonly=True),
- }
-
- def _get_empid(self, cr, uid, context=None):
- emp_id = context.get('emp_id', self.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)], context=context))
- if emp_id:
- employee = self.pool.get('hr.employee').browse(cr, uid, emp_id, context=context)[0]
- return {'name': employee.name, 'state': employee.state, 'emp_id': emp_id[0]}
- return {}
-
- def default_get(self, cr, uid, fields_list, context=None):
- res = super(hr_sign_in_out, self).default_get(cr, uid, fields_list, context=context)
- res_emp = self._get_empid(cr, uid, context=context)
- res.update(res_emp)
- return res
-
- def si_check(self, cr, uid, ids, context=None):
- obj_model = self.pool.get('ir.model.data')
- att_obj = self.pool.get('hr.attendance')
- data = self.read(cr, uid, ids, [], context=context)[0]
- data['emp_id'] = data['emp_id'] and data['emp_id'][0]
- emp_id = data['emp_id']
- att_id = att_obj.search(cr, uid, [('employee_id', '=', emp_id)], limit=1, order='name desc')
- last_att = att_obj.browse(cr, uid, att_id, context=context)
- if last_att:
- last_att = last_att[0]
- cond = not last_att or last_att.action == 'sign_out'
- if cond:
- return self.sign_in(cr, uid, data, context)
- else:
- model_data_ids = obj_model.search(cr,uid,[('model','=','ir.ui.view'),('name','=','view_hr_attendance_so_ask')], context=context)
- resource_id = obj_model.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
- return {
- 'name': _('Sign in / Sign out'),
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'hr.sign.in.out.ask',
- 'views': [(resource_id,'form')],
- 'type': 'ir.actions.act_window',
- 'context': context,
- 'target': 'new',
- }
-
- def so_check(self, cr, uid, ids, context=None):
- obj_model = self.pool.get('ir.model.data')
- att_obj = self.pool.get('hr.attendance')
- data = self.read(cr, uid, ids, [], context=context)[0]
- data['emp_id'] = data['emp_id'] and data['emp_id'][0]
- emp_id = data['emp_id']
- att_id = att_obj.search(cr, uid, [('employee_id', '=', emp_id),('action', '!=', 'action')], limit=1, order='name desc')
- last_att = att_obj.browse(cr, uid, att_id, context=context)
- if last_att:
- last_att = last_att[0]
- if not att_id and not last_att:
- model_data_ids = obj_model.search(cr, uid, [('model','=','ir.ui.view'),('name','=','view_hr_attendance_message')], context=context)
- resource_id = obj_model.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
- return {
- 'name': _('Sign in / Sign out'),
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'hr.sign.in.out',
- 'views': [(resource_id,'form')],
- 'type': 'ir.actions.act_window',
- 'context': context,
- 'target': 'new',
- }
-
- cond = last_att and last_att['action'] == 'sign_in'
- if cond:
- return self.sign_out(cr, uid, data, context)
- else:
- model_data_ids = obj_model.search(cr, uid, [('model','=','ir.ui.view'),('name','=','view_hr_attendance_si_ask')], context=context)
- resource_id = obj_model.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
- return {
- 'name': _('Sign in / Sign out'),
- 'view_type': 'form',
- 'view_mode': 'tree,form',
- 'res_model': 'hr.sign.in.out.ask',
- 'views': [(resource_id,'form')],
- 'type': 'ir.actions.act_window',
- 'target': 'new',
- }
-
- def sign_in(self, cr, uid, data, context=None):
- if context is None:
- context = {}
- emp_id = data['emp_id']
- if 'last_time' in data:
- if data['last_time'] > time.strftime('%Y-%m-%d %H:%M:%S'):
- raise osv.except_osv(_('User Error!'), _('The sign-out date must be in the past.'))
- self.pool.get('hr.attendance').create(cr, uid, {'name': data['last_time'], 'action': 'sign_out',
- 'employee_id': emp_id}, context=context)
- try:
- self.pool.get('hr.employee').attendance_action_change(cr, uid, [emp_id], 'sign_in')
- except:
- raise osv.except_osv(_('User Error!'), _('A sign-in must be right after a sign-out!'))
- return {'type': 'ir.actions.act_window_close'} # To do: Return Success message
-
- def sign_out(self, cr, uid, data, context=None):
- emp_id = data['emp_id']
- if 'last_time' in data:
- if data['last_time'] > time.strftime('%Y-%m-%d %H:%M:%S'):
- raise osv.except_osv(_('User Error!'), _('The sign-in date must be in the past.'))
- self.pool.get('hr.attendance').create(cr, uid, {'name':data['last_time'], 'action':'sign_in', 'employee_id':emp_id}, context=context)
- try:
- self.pool.get('hr.employee').attendance_action_change(cr, uid, [emp_id], 'sign_out')
- except:
- raise osv.except_osv(_('User Error!'), _('A sign-out must be right after a sign-in.'))
- return {'type': 'ir.actions.act_window_close'} # To do: Return Success message
-
-hr_sign_in_out()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
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
deleted file mode 100644
index 5c84be5107f..00000000000
--- a/addons/hr_attendance/wizard/hr_attendance_sign_in_out_view.xml
+++ /dev/null
@@ -1,90 +0,0 @@
-
-
-
-
- hr.sign.in.out.form
- hr.sign.in.out
-
-
-
-
-
-
- hr.sign.in.out.form
- hr.sign.in.out
-
-
-
-
-
-
- Sign in / Sign out
- hr.sign.in.out
- form
- tree,form
-
- new
- Sign in / Sign out. In some companies, staff have to sign in when they arrive at work and sign out again at the end of the day. If each employee has been linked to a system user, then they can encode their time with this action button.
-
-
-
-
-
- hr.sign.in.out.ask.form
- hr.sign.in.out.ask
-
-
-
-
-
-
- hr.sign.in.out.ask.form
- hr.sign.in.out.ask
-
-
-
-
-
-
-
diff --git a/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py b/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py
index 34cfee40262..e92e88bdcbd 100644
--- a/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py
+++ b/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py
@@ -91,7 +91,7 @@ class hr_so_project(osv.osv_memory):
emp_obj = self.pool.get('hr.employee')
for data in self.browse(cr, uid, ids, context=context):
emp_id = data.emp_id.id
- emp_obj.attendance_action_change(cr, uid, [emp_id], type='sign_out', dt=data.date)
+ emp_obj.attendance_action_change(cr, uid, [emp_id], {'action':'sign_out', 'action_date':data.date})
self._write(cr, uid, data, emp_id, context=context)
return {'type': 'ir.actions.act_window_close'}
@@ -99,7 +99,7 @@ class hr_so_project(osv.osv_memory):
emp_obj = self.pool.get('hr.employee')
for data in self.browse(cr, uid, ids, context=context):
emp_id = data.emp_id.id
- emp_obj.attendance_action_change(cr, uid, [emp_id], type='action', dt=data.date)
+ emp_obj.attendance_action_change(cr, uid, [emp_id], {'action':'action', 'action_date':data.date})
self._write(cr, uid, data, emp_id, context=context)
return {'type': 'ir.actions.act_window_close'}
@@ -156,7 +156,7 @@ class hr_si_project(osv.osv_memory):
emp_obj = self.pool.get('hr.employee')
for data in self.browse(cr, uid, ids, context=context):
emp_id = data.emp_id.id
- emp_obj.attendance_action_change(cr, uid, [emp_id], type = 'sign_in' ,dt=data.date or False)
+ emp_obj.attendance_action_change(cr, uid, [emp_id], {'action':'sign_in', 'action_date':data.date})
return {'type': 'ir.actions.act_window_close'}
def default_get(self, cr, uid, fields_list, context=None):
diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py
index 05e70a19acb..fcdbfda0667 100644
--- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py
+++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py
@@ -312,31 +312,12 @@ class hr_timesheet_sheet(osv.osv):
self.write(cr, uid, [sheet.id], {'date_current': sheet.date_to,}, context=context)
return True
- def check_sign(self, cr, uid, ids, typ, context=None):
- sheet = self.browse(cr, uid, ids, context=context)[0]
- if not sheet.date_current == time.strftime('%Y-%m-%d'):
- raise osv.except_osv(_('Error!'), _('You cannot sign in/sign out from other date than today.'))
- return True
-
- def sign(self, cr, uid, ids, typ, context=None):
- self.check_sign(cr, uid, ids, typ, context=context)
- sign_obj = self.pool.get('hr.sign.in.out')
- sheet = self.browse(cr, uid, ids, context=context)[0]
- context['emp_id'] = [sheet.employee_id.id]
- sign_id = sign_obj.create(cr, uid, {}, context=context)
- methods = {'sign_in': sign_obj.si_check,
- 'sign_out': sign_obj.so_check}
- wizard_result = methods[typ](cr, uid, [sign_id], context=context)
- if wizard_result.get('type', False) == 'ir.actions.act_window_close':
- return True # ensure we do not close the main window !
- wizard_result['nodestroy'] = True # do not destroy the main window !
- return wizard_result
-
- def sign_in(self, cr, uid, ids, context=None):
- return self.sign(cr, uid, ids, 'sign_in', context=context)
-
- def sign_out(self, cr, uid, ids, context=None):
- return self.sign(cr, uid, ids, 'sign_out', context=context)
+ def attendance_action_change(self, cr, uid, ids, context=None):
+ hr_employee = self.pool.get('hr.employee')
+ employee_ids = []
+ for sheet in self.browse(cr, uid, ids, context=context):
+ if sheet.employee_id.id not in employee_ids: employee_ids.append(sheet.employee_id.id)
+ return hr_employee.attendance_action_change(cr, uid, employee_ids, context=context)
_columns = {
'name': fields.char('Note', size=64, select=1,
diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_demo.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_demo.xml
index a73bbb3050e..42497eb537e 100644
--- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_demo.xml
+++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_demo.xml
@@ -2,12 +2,12 @@
-
+
diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml
index 6c4ee63cbe6..5dd71eadd1b 100644
--- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml
+++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml
@@ -92,9 +92,9 @@
-
-
-
+
+
+
diff --git a/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml b/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml
index 352861263b8..849c2fa7caa 100644
--- a/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml
+++ b/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml
@@ -26,7 +26,7 @@
Now, at the time of login, I create Attendances and perform "Sign In" action.
-
!python {model: hr_timesheet_sheet.sheet}: |
- self.sign_in(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')], {})
+ self.attendance_action_change(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')], {})
task_work = self.search(cr, uid, [("name","=","Quentin Paolinon")],context)[0]
task_ids = self.browse(cr, uid, task_work, context)
assert task_ids.state == "draft", "I State In Timesheet"