From 405f416defcbc101b15106dd457ffba9ddb4e4b8 Mon Sep 17 00:00:00 2001 From: Xavier ALT Date: Tue, 23 Oct 2012 13:35:20 +0200 Subject: [PATCH] [FIX] hr_holidays: fix missing context and non-translated holidays leave type bzr revid: xal@openerp.com-20121023113520-mptvo9ev2avkqhtx --- .../hr_holidays/report/holidays_summary_report.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/addons/hr_holidays/report/holidays_summary_report.py b/addons/hr_holidays/report/holidays_summary_report.py index f5a7b087c83..661bc7d201c 100644 --- a/addons/hr_holidays/report/holidays_summary_report.py +++ b/addons/hr_holidays/report/holidays_summary_report.py @@ -97,8 +97,11 @@ class report_custom(report_rml): date_today=time.strftime('%Y-%m-%d %H:%M:%S') date_xml +=['' % (res,date_today)] - cr.execute("SELECT id, name, color_name FROM hr_holidays_status ORDER BY id") - legend=cr.fetchall() + holidays_status_obj = pooler.get_pool(cr.dbname).get('hr.holidays.status') + holidays_status_ids_all = holidays_status_obj.search(cr, uid, [], order='id', context=context) + holidays_status_values = dict(((x['id'], x) for x in holidays_status_obj.read(cr, uid, holidays_status_ids_all, ['id','name','color_name'], context=context) )) + holidays_status_values = [ holidays_status_values[id] for id in holidays_status_ids_all ] + legend=holidays_status_values today=datetime.datetime.today() first_date=data['form']['date_from'] @@ -122,7 +125,7 @@ class report_custom(report_rml): # date_xml=[] for l in range(0,len(legend)): - date_xml += ['' % (l+1,legend[l][0],_(legend[l][1]),legend[l][2])] + date_xml += ['' % (l+1,legend[l]['id'],_(legend[l]['name']),legend[l]['color_name'])] date_xml += ['' % (som.strftime('%B'), som.year),''] cell=1 @@ -209,7 +212,7 @@ class report_custom(report_rml): if data['model']=='hr.employee': for id in data['form']['emp']: - items = obj_emp.read(cr, uid, id, ['id','name']) + items = obj_emp.read(cr, uid, id, ['id','name'], context=context) emp_xml += emp_create_xml(self, cr, uid, 0, holiday_type, row_id, items['id'], items['name'], som, eom) row_id = row_id +1 @@ -223,7 +226,7 @@ class report_custom(report_rml): if emp_ids==[]: continue dept_done=0 - for item in obj_emp.read(cr, uid, emp_ids, ['id', 'name']): + for item in obj_emp.read(cr, uid, emp_ids, ['id', 'name'], context=context): if dept_done==0: emp_xml += emp_create_xml(self, cr, uid, 1, holiday_type, row_id, dept.id, dept.name, som, eom) row_id = row_id +1 @@ -236,7 +239,7 @@ class report_custom(report_rml): %s %s - ''' % (str(rml_obj.formatLang(time.strftime("%Y-%m-%d"),date=True))+' ' + str(time.strftime("%H:%M")),pooler.get_pool(cr.dbname).get('res.users').browse(cr,uid,uid).company_id.name) + ''' % (str(rml_obj.formatLang(time.strftime("%Y-%m-%d"),date=True))+' ' + str(time.strftime("%H:%M")),pooler.get_pool(cr.dbname).get('res.users').browse(cr,uid,uid, context=context).company_id.name) # Computing the xml xml='''