From a6d42b32e2a36a116feb64d4cdec9a3bf0e1b00d Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Fri, 29 Oct 2010 12:54:30 +0530 Subject: [PATCH] [REF] hr_attenedace: code improved bzr revid: mra@mra-laptop-20101029072430-d1siyfqhmftqka56 --- addons/hr_attendance/hr_attendance.py | 8 +++----- addons/hr_attendance/wizard/hr_attendance_byweek.py | 1 + 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/addons/hr_attendance/hr_attendance.py b/addons/hr_attendance/hr_attendance.py index c51406f19de..9e8a4d84088 100644 --- a/addons/hr_attendance/hr_attendance.py +++ b/addons/hr_attendance/hr_attendance.py @@ -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: \ No newline at end of file diff --git a/addons/hr_attendance/wizard/hr_attendance_byweek.py b/addons/hr_attendance/wizard/hr_attendance_byweek.py index e2b071de66a..66b8567d070 100644 --- a/addons/hr_attendance/wizard/hr_attendance_byweek.py +++ b/addons/hr_attendance/wizard/hr_attendance_byweek.py @@ -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: \ No newline at end of file