Meera Trambadia (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-798739-mtr into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #798739 in OpenERP Addons: "[PS] Imposible to confirm an allocation 
request"
  https://bugs.launchpad.net/openobject-addons/+bug/798739

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-798739-mtr/+merge/66124

hr_holidays:-Exception raised on confirmation of leave request is now 
translated in user's lang." --fixes=lp:798739
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-798739-mtr/+merge/66124
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-798739-mtr.
=== modified file 'hr_holidays/hr_holidays.py'
--- hr_holidays/hr_holidays.py	2011-06-20 06:04:34 +0000
+++ hr_holidays/hr_holidays.py	2011-06-28 11:58:30 +0000
@@ -224,14 +224,20 @@
         return True
 
     def holidays_validate(self, cr, uid, ids, *args):
-        self.check_holidays(cr, uid, ids)
+        context = {}
+        lang = self.pool.get('res.users').browse(cr, uid, uid).context_lang
+        context.update({'lang': lang})
+        self.check_holidays(cr, uid, ids, context=context)
         obj_emp = self.pool.get('hr.employee')
         ids2 = obj_emp.search(cr, uid, [('user_id', '=', uid)])
         manager = ids2 and ids2[0] or False
         return self.write(cr, uid, ids, {'state':'validate1', 'manager_id': manager})
 
     def holidays_validate2(self, cr, uid, ids, *args):
-        self.check_holidays(cr, uid, ids)
+        context = {}
+        lang = self.pool.get('res.users').browse(cr, uid, uid).context_lang
+        context.update({'lang': lang})
+        self.check_holidays(cr, uid, ids, context=context)
         obj_emp = self.pool.get('hr.employee')
         ids2 = obj_emp.search(cr, uid, [('user_id', '=', uid)])
         manager = ids2 and ids2[0] or False
@@ -277,7 +283,10 @@
         return True
 
     def holidays_confirm(self, cr, uid, ids, *args):
-        self.check_holidays(cr, uid, ids)
+        context = {}
+        lang = self.pool.get('res.users').browse(cr, uid, uid).context_lang
+        context.update({'lang': lang})
+        self.check_holidays(cr, uid, ids, context=context)
         return self.write(cr, uid, ids, {'state':'confirm'})
 
     def holidays_refuse(self, cr, uid, ids, *args):
@@ -302,8 +311,10 @@
 
         return True
 
-    def check_holidays(self, cr, uid, ids):
+    def check_holidays(self, cr, uid, ids, context=None):
         holi_status_obj = self.pool.get('hr.holidays.status')
+        if context is None:
+            context = {}
         for record in self.browse(cr, uid, ids):
             if record.holiday_type == 'employee' and record.type == 'remove':
                 if record.employee_id and not record.holiday_status_id.limit:

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to