[FIX] hr_holidays:-Exception raised on confirmation of leave request is now translated in user's lang.
lp bug: https://launchpad.net/bugs/798739 fixed bzr revid: mtr@mtr-20110628114633-78h4k4q3d8jectjo
This commit is contained in:
parent
eedefe1ebc
commit
5cc4b243b6
|
@ -224,14 +224,20 @@ class hr_holidays(osv.osv):
|
|||
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 @@ class hr_holidays(osv.osv):
|
|||
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 @@ class hr_holidays(osv.osv):
|
|||
|
||||
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:
|
||||
|
|
Loading…
Reference in New Issue