[REF] hr_attenedace: code improved

bzr revid: mra@mra-laptop-20101029072430-d1siyfqhmftqka56
This commit is contained in:
Mustufa Rangwala 2010-10-29 12:54:30 +05:30
parent 62fba6d0bb
commit a6d42b32e2
2 changed files with 4 additions and 5 deletions

View File

@ -41,9 +41,7 @@ def _employee_get(obj, cr, uid, context=None):
if context is None:
context = {}
ids = obj.pool.get('hr.employee').search(cr, uid, [('user_id', '=', uid)], context=context)
if ids:
return ids[0]
return False
return ids and ids[0] or False
class hr_attendance(osv.osv):
_name = "hr.attendance"
@ -65,7 +63,7 @@ class hr_attendance(osv.osv):
'day': fields.function(_day_compute, method=True, type='char', string='Day', store=True, select=1, size=32),
}
_defaults = {
'name': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'), #Don't remove the lambda, if you remove it then the current time will not change
'name': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'), #please don't remove the lambda, if you remove it then the current time will not change
'employee_id': _employee_get,
}
@ -158,4 +156,4 @@ class hr_employee(osv.osv):
hr_employee()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -47,6 +47,7 @@ class hr_attendance_byweek(osv.osv_memory):
'report_name': 'hr.attendance.allweeks',
'datas': datas,
}
hr_attendance_byweek()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: