diff --git a/addons/hr_attendance/static/src/js/attendance.js b/addons/hr_attendance/static/src/js/attendance.js index a1184532f08..ae044475813 100644 --- a/addons/hr_attendance/static/src/js/attendance.js +++ b/addons/hr_attendance/static/src/js/attendance.js @@ -68,7 +68,7 @@ openerp.hr_attendance = function(instance) { return this._super(ids, callback, error_callback); }, call_button: function (method, args, callback, error_callback) { - if (this._model.name == "hr.employee" && method == "attendance_action_change"){ + if (method == "attendance_action_change"){ callback = instance.hr_attendance.callback(callback); } return this._super(method, args, callback, error_callback); diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index 3e0f3963ad5..870dd0bc413 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -312,31 +312,14 @@ 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 an other date than today')) - return True + + 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) - 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) _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 54ef27ef8c7..91b61969ca8 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml @@ -91,6 +91,8 @@ +