[IMP] hr_holidays: code improvements
bzr revid: qdp-launchpad@openerp.com-20110610091728-e49r3pq8tey78dhx
This commit is contained in:
@@ -334,7 +334,7 @@ class hr_employee(osv.osv):
|
||||
# Find for holidays status
|
||||
status_ids = type_obj.search(cr, uid, [('limit', '=', False)], context=context)
|
||||
if len(status_ids) != 1 :
|
||||
raise osv.except_osv(('warning !'),_("To use this feature, you should have only one leave type without the option 'Allow to Override Limit' set (%s Found).") % (len(status_ids)))
|
||||
raise osv.except_osv(_('Warning !'),_("To use this feature, you must have only one leave type without the option 'Allow to Override Limit' set. (%s Found).") % (len(status_ids)))
|
||||
status_id = status_ids and status_ids[0] or False
|
||||
if not status_id:
|
||||
return False
|
||||
@@ -352,8 +352,8 @@ class hr_employee(osv.osv):
|
||||
type_obj = self.pool.get('hr.holidays.status')
|
||||
status_ids = type_obj.search(cr, uid, [('limit', '=', False)], context=context)
|
||||
if len(status_ids) != 1 :
|
||||
raise osv.except_osv(('Warning !'),_("You should have only one leave type without allowing override limit. %s Found !") % (len(status_ids)))
|
||||
cr.execute("SELECT sum(h.number_of_days_temp) as days, h.employee_id from hr_holidays h join hr_holidays_status s on (s.id=h.holiday_status_id) where h.type='add' and h.state='validate' and s.limit=False group by h.employee_id")
|
||||
raise osv.except_osv(_('Warning !'),_("You should have only one leave type without the option 'Allow to Override Limit' set. (%s Found).") % (len(status_ids)))
|
||||
cr.execute("SELECT sum(h.number_of_days_temp) as days, h.employee_id from hr_holidays h join hr_holidays_status s on (s.id=h.holiday_status_id) where h.type='add' and h.state='validate' and s.limit=False group by h.employee_id")
|
||||
res = cr.dictfetchall()
|
||||
remaining = {}
|
||||
for r in res:
|
||||
@@ -365,7 +365,7 @@ class hr_employee(osv.osv):
|
||||
|
||||
|
||||
_columns = {
|
||||
'remaining_leaves': fields.function(_get_remaining_days, method=True, string='Remaining Leaves', fnct_inv=_set_remaining_days, type="float", help='Remaining Leaves', store=True),
|
||||
'remaining_leaves': fields.function(_get_remaining_days, method=True, string='Remaining Leaves', fnct_inv=_set_remaining_days, type="float", help='Total number of legal leaves allocated to this employee, change this value to create allocation/leave requests.', store=True),
|
||||
}
|
||||
|
||||
hr_employee()
|
||||
|
||||
Reference in New Issue
Block a user