From 833a99d777a3370158ee437abcdf28b60cedc493 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Fri, 10 Jun 2011 11:17:28 +0200 Subject: [PATCH] [IMP] hr_holidays: code improvements bzr revid: qdp-launchpad@openerp.com-20110610091728-e49r3pq8tey78dhx --- addons/hr_holidays/hr_holidays.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/hr_holidays/hr_holidays.py b/addons/hr_holidays/hr_holidays.py index 550ac15fd63..31d4aa50a1d 100644 --- a/addons/hr_holidays/hr_holidays.py +++ b/addons/hr_holidays/hr_holidays.py @@ -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()