[FIX] set the missing selection on related field currunt status.
bzr revid: nco@tinyerp.com-20130529044835-a3faab0nasqfntvk
This commit is contained in:
parent
87f3996894
commit
8c8a9378d8
|
@ -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],))
|
||||
|
|
|
@ -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')
|
||||
|
|
Loading…
Reference in New Issue