From c2ba873ab842a98efa4f12cb9b73784c6fd577bc Mon Sep 17 00:00:00 2001 From: mtr Date: Thu, 30 Jun 2011 14:06:02 +0530 Subject: [PATCH] [IMP] hr_holidays: improved code for translation using context bzr revid: mtr@mtr-20110630083602-au21nsi3yyw97qnp --- addons/hr_holidays/hr_holidays.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/addons/hr_holidays/hr_holidays.py b/addons/hr_holidays/hr_holidays.py index 4c000aab968..3dfc9370ecc 100644 --- a/addons/hr_holidays/hr_holidays.py +++ b/addons/hr_holidays/hr_holidays.py @@ -224,9 +224,8 @@ class hr_holidays(osv.osv): return True def holidays_validate(self, cr, uid, ids, *args): - context = {} lang = self.pool.get('res.users').browse(cr, uid, uid).context_lang - context.update({'lang': lang}) + context = {'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)]) @@ -234,9 +233,8 @@ class hr_holidays(osv.osv): return self.write(cr, uid, ids, {'state':'validate1', 'manager_id': manager}) def holidays_validate2(self, cr, uid, ids, *args): - context = {} lang = self.pool.get('res.users').browse(cr, uid, uid).context_lang - context.update({'lang': lang}) + context = {'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)]) @@ -283,9 +281,8 @@ class hr_holidays(osv.osv): return True def holidays_confirm(self, cr, uid, ids, *args): - context = {} lang = self.pool.get('res.users').browse(cr, uid, uid).context_lang - context.update({'lang': lang}) + context = {'lang': lang} self.check_holidays(cr, uid, ids, context=context) return self.write(cr, uid, ids, {'state':'confirm'}) @@ -313,8 +310,6 @@ class hr_holidays(osv.osv): 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: