[IMP] Hr_holidays: Improve the code by making generic method for context lang get
bzr revid: mra@mra-laptop-20110630092905-4ggbh1i7bnm7ibqb
This commit is contained in:
@@ -223,9 +223,12 @@ class hr_holidays(osv.osv):
|
||||
wf_service.trg_create(uid, 'hr.holidays', id, cr)
|
||||
return True
|
||||
|
||||
def holidays_validate(self, cr, uid, ids, *args):
|
||||
def get_user_lang(self, cr, uid, ids):
|
||||
lang = self.pool.get('res.users').browse(cr, uid, uid).context_lang
|
||||
context = {'lang': lang}
|
||||
return {'lang': lang}
|
||||
|
||||
def holidays_validate(self, cr, uid, ids, *args):
|
||||
context = self.get_user_lang(cr, uid, ids)
|
||||
self.check_holidays(cr, uid, ids, context=context)
|
||||
obj_emp = self.pool.get('hr.employee')
|
||||
ids2 = obj_emp.search(cr, uid, [('user_id', '=', uid)])
|
||||
@@ -233,8 +236,7 @@ class hr_holidays(osv.osv):
|
||||
return self.write(cr, uid, ids, {'state':'validate1', 'manager_id': manager})
|
||||
|
||||
def holidays_validate2(self, cr, uid, ids, *args):
|
||||
lang = self.pool.get('res.users').browse(cr, uid, uid).context_lang
|
||||
context = {'lang': lang}
|
||||
context = self.get_user_lang(cr, uid, ids)
|
||||
self.check_holidays(cr, uid, ids, context=context)
|
||||
obj_emp = self.pool.get('hr.employee')
|
||||
ids2 = obj_emp.search(cr, uid, [('user_id', '=', uid)])
|
||||
@@ -281,8 +283,7 @@ class hr_holidays(osv.osv):
|
||||
return True
|
||||
|
||||
def holidays_confirm(self, cr, uid, ids, *args):
|
||||
lang = self.pool.get('res.users').browse(cr, uid, uid).context_lang
|
||||
context = {'lang': lang}
|
||||
context = self.get_user_lang(cr, uid, ids)
|
||||
self.check_holidays(cr, uid, ids, context=context)
|
||||
return self.write(cr, uid, ids, {'state':'confirm'})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user