[IMP]hr_holidayse: raise an error if there are more than 1 leave type with "allow...
authoraag (OpenERP) <aag@tinyerp.co.in>
Fri, 27 May 2011 12:26:56 +0000 (17:56 +0530)
committeraag (OpenERP) <aag@tinyerp.co.in>
Fri, 27 May 2011 12:26:56 +0000 (17:56 +0530)
bzr revid: aag@tinyerp.co.in-20110527122656-rouugxlm417tj5fp

addons/hr_holidays/hr_holidays.py
addons/hr_holidays/hr_holidays_data.xml

index d8605f2..51bd704 100644 (file)
@@ -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
index 825f8b6..2c0debb 100644 (file)
@@ -5,7 +5,6 @@
     <!-- Casual leave -->
     <record model="hr.holidays.status" id="holiday_status_cl">
       <field name="name">Legal Leaves</field>
-      <field name="limit">False</field>
       <field name="color_name">black</field>
     </record>
 
@@ -20,7 +19,7 @@
     <!-- Compensatory Days -->
     <record model="hr.holidays.status" id="holiday_status_comp">
       <field name="name">Compensatory Days</field>
-      <field name="limit">False</field>
+      <field name="limit">True</field>
       <field name="color_name">brown</field>
     </record>