From: aag (OpenERP) Date: Fri, 27 May 2011 12:26:56 +0000 (+0530) Subject: [IMP]hr_holidayse: raise an error if there are more than 1 leave type with "allow... X-Git-Tag: 6.1.0-rc1-addons~3053^2~25^2~1 X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;h=8c5726ef5f886c2cbe40bfe8546305f5a623a761;p=odoo%2Fodoo.git [IMP]hr_holidayse: raise an error if there are more than 1 leave type with "allow to override limit" = False, also if there is no such leave type bzr revid: aag@tinyerp.co.in-20110527122656-rouugxlm417tj5fp --- diff --git a/addons/hr_holidays/hr_holidays.py b/addons/hr_holidays/hr_holidays.py index d8605f2..51bd704 100644 --- a/addons/hr_holidays/hr_holidays.py +++ b/addons/hr_holidays/hr_holidays.py @@ -333,6 +333,8 @@ class hr_employee(osv.osv): holiday_obj = self.pool.get('hr.holidays') # 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 !'),_("You should have only one leave type without allowing override limit, %s Found !") % (len(status_ids))) status_id = status_ids and status_ids[0] or False if not status_id or diff <= 0: return False diff --git a/addons/hr_holidays/hr_holidays_data.xml b/addons/hr_holidays/hr_holidays_data.xml index 825f8b6..2c0debb 100644 --- a/addons/hr_holidays/hr_holidays_data.xml +++ b/addons/hr_holidays/hr_holidays_data.xml @@ -5,7 +5,6 @@ Legal Leaves - False black @@ -20,7 +19,7 @@ Compensatory Days - False + True brown