diff --git a/addons/hr_attendance/hr_attendance.py b/addons/hr_attendance/hr_attendance.py index fcb1ea7a161..dcff0ad5085 100644 --- a/addons/hr_attendance/hr_attendance.py +++ b/addons/hr_attendance/hr_attendance.py @@ -108,7 +108,7 @@ class hr_employee(osv.osv): AND hr_attendance.name = foo.name) \ WHERE hr_attendance.employee_id IN %s',(tuple(ids),)) for res in cr.fetchall(): - result[res[1]] = res[0] == 'sign_in' and 'Present' or 'Absent' + result[res[1]] = res[0] == 'sign_in' and 'present' or 'absent' return result def _last_sign(self, cr, uid, ids, name, args, context=None): @@ -152,8 +152,8 @@ class hr_employee(osv.osv): 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' + if employee.state == 'present': action = 'sign_out' + if employee.state == 'absent': action = 'sign_in' 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],)) 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 a554fc73d3d..04ddc87ef10 100644 --- a/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py +++ b/addons/hr_timesheet/wizard/hr_timesheet_sign_in_out.py @@ -19,6 +19,7 @@ # ############################################################################## import time +from lxml import etree from openerp.osv import fields, osv from openerp.tools.translate import _ @@ -33,7 +34,7 @@ class hr_so_project(osv.osv_memory): 'date': fields.datetime('Closing Date'), 'analytic_amount': fields.float('Minimum Analytic Amount'), 'name': fields.char('Employees Name', size=32, required=True, readonly=True), - 'state': fields.related('emp_id', 'state', string='Current Status', type='char', required=True, readonly=True), + 'state': fields.related('emp_id', 'state', string='Current Status', type='selection', selection=[('absent', 'Absent'), ('present', 'Present')], required=True, readonly=True), 'server_date': fields.datetime('Current Date', required=True, readonly=True), 'emp_id': fields.many2one('hr.employee', 'Employee ID') } @@ -110,7 +111,7 @@ class hr_si_project(osv.osv_memory): _description = 'Sign In By Project' _columns = { 'name': fields.char('Employees Name', size=32, readonly=True), - 'state': fields.related('emp_id', 'state', string='Current Status', type='char', required=True, readonly=True), + 'state': fields.related('emp_id', 'state', string='Current Status', type='selection', selection=[('absent', 'Absent'), ('present', 'Present')], required=True, readonly=True), 'date': fields.datetime('Starting Date'), 'server_date': fields.datetime('Current Date', readonly=True), 'emp_id': fields.many2one('hr.employee', 'Employee ID')