diff --git a/addons/hr_attendance/hr_attendance.py b/addons/hr_attendance/hr_attendance.py index 584340d6c1d..07ef528a7c9 100644 --- a/addons/hr_attendance/hr_attendance.py +++ b/addons/hr_attendance/hr_attendance.py @@ -137,7 +137,7 @@ class hr_employee(osv.osv): res = {'action': type, 'employee_id': emp['id']} if dt: - res['name'] = dt + res['name'] = dt id = obj_attendance.create(cr, uid, res, context=context) if type != 'action': @@ -146,4 +146,4 @@ class hr_employee(osv.osv): hr_employee() -# 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_contract/security/ir.model.access.csv b/addons/hr_contract/security/ir.model.access.csv index 202fcb3bdb4..7c87e3c36b3 100644 --- a/addons/hr_contract/security/ir.model.access.csv +++ b/addons/hr_contract/security/ir.model.access.csv @@ -4,3 +4,4 @@ "access_hr_resource_manager","hr.employee.resource.manager","resource.model_resource_resource","base.group_hr_manager",1,1,1,1 "access_hr_resource_calendar_user","hr.employee.resource.calendar.user","resource.model_resource_calendar","base.group_hr_user",1,1,1,1 "access_hr_contract_type_manager","hr.contract.type.manager","model_hr_contract_type","base.group_hr_manager",1,1,1,1 +"access_hr_contract_manager","hr.contract.manager","model_hr_contract","base.group_hr_manager",1,1,1,1 diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py index 6c7c5618311..986a4a734c3 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py @@ -237,27 +237,23 @@ class hr_timesheet_sheet(osv.osv): self.write(cr, uid, [sheet.id], {'date_current': sheet.date_to,}, context=context) return True - def sign_in(self, cr, uid, ids, context=None): + def sign(self, cr, uid, ids, typ, context=None): emp_obj = self.pool.get('hr.employee') + sheet = self.browse(cr, uid, ids, context=context)[0] if context is None: context = {} - if not self.browse(cr, uid, ids, context=context)[0].date_current == time.strftime('%Y-%m-%d'): + if not sheet.date_current == time.strftime('%Y-%m-%d'): raise osv.except_osv(_('Error !'), _('You can not sign in from an other date than today')) - emp_ids = emp_obj.search(cr, uid, [('user_id', '=', uid)], context=context) + emp_id = sheet.employee_id.id context['sheet_id']=ids[0] - emp_obj.attendance_action_change(cr, uid, emp_ids, type='sign_in', context=context,) + emp_obj.attendance_action_change(cr, uid, [emp_id], type=typ, context=context,) return True + def sign_in(self, cr, uid, ids, context=None): + return self.sign(cr,uid,ids,'sign_in',context=None) + def sign_out(self, cr, uid, ids, context=None): - emp_obj = self.pool.get('hr.employee') - if context is None: - context = {} - if not self.browse(cr, uid, ids, context=context)[0].date_current == time.strftime('%Y-%m-%d'): - raise osv.except_osv(_('Error !'), _('You can not sign out from an other date than today')) - emp_ids = emp_obj.search(cr, uid, [('user_id', '=', uid)]) - context['sheet_id']=ids[0] - emp_obj.attendance_action_change(cr, uid, emp_ids, type='sign_out', context=context,) - return True + return self.sign(cr,uid,ids,'sign_out',context=None) _columns = { 'name': fields.char('Description', size=64, select=1,