diff --git a/addons/hr_holidays/report/holidays_summary_report.py b/addons/hr_holidays/report/holidays_summary_report.py
index f3a17be3015..851defe7e73 100644
--- a/addons/hr_holidays/report/holidays_summary_report.py
+++ b/addons/hr_holidays/report/holidays_summary_report.py
@@ -94,13 +94,13 @@ class report_custom(report_rml):
emp_id={}
# done={}
- cr.execute("select name from res_company")
+ cr.execute("SELECT name FROM res_company")
res=cr.fetchone()[0]
date_xml=[]
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")
+ cr.execute("SELECT id, name, color_name FROM hr_holidays_status ORDER BY id")
legend=cr.fetchall()
today=datetime.datetime.today()
@@ -221,23 +221,19 @@ class report_custom(report_rml):
elif data['model']=='ir.ui.menu':
for id in data['form']['depts']:
dept = obj_dept.browse(cr, uid, id, context=context)
-
- cr.execute("""select dept.manager_id from hr_department dept\
- where dept.id = %s""", (id,))
- result=cr.fetchall()
- if result==[]:
+ cr.execute("""SELECT id FROM hr_employee \
+ WHERE department_id = %s""", (id,))
+ emp_ids = [x[0] for x in cr.fetchall()]
+ if emp_ids==[]:
continue
dept_done=0
- for d in range(0,len(result)):
- emp_id[d] = obj_emp.search(cr, uid, [('user_id', '=', result[d][0])])
- items = obj_emp.read(cr, uid, emp_id[d], ['id', 'name'])
- for item in items:
- 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
- dept_done=1
- emp_xml += emp_create_xml(self, cr, uid, 0, holiday_type, row_id, item['id'], item['name'], som, eom)
+ for item in obj_emp.read(cr, uid, emp_ids, ['id', 'name']):
+ 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
+ dept_done=1
+ emp_xml += emp_create_xml(self, cr, uid, 0, holiday_type, row_id, item['id'], item['name'], som, eom)
+ row_id = row_id +1
# Computing the xml
xml='''
diff --git a/addons/hr_holidays/wizard/hr_holidays_summary_department.py b/addons/hr_holidays/wizard/hr_holidays_summary_department.py
index 06651e11d33..9a99d9eff63 100644
--- a/addons/hr_holidays/wizard/hr_holidays_summary_department.py
+++ b/addons/hr_holidays/wizard/hr_holidays_summary_department.py
@@ -34,7 +34,7 @@ class hr_holidays_summary_dept(osv.osv_memory):
}
_defaults = {
- 'date_from': time.strftime('%Y-%m-%d'),
+ 'date_from': time.strftime('%Y-%m-01'),
'holiday_type': 'Validated'
}
diff --git a/addons/hr_holidays/wizard/hr_holidays_summary_employees.py b/addons/hr_holidays/wizard/hr_holidays_summary_employees.py
index 379ff7d76c7..0fa58b01581 100644
--- a/addons/hr_holidays/wizard/hr_holidays_summary_employees.py
+++ b/addons/hr_holidays/wizard/hr_holidays_summary_employees.py
@@ -33,7 +33,7 @@ class hr_holidays_summary_employee(osv.osv_memory):
}
_defaults = {
- 'date_from': time.strftime('%Y-%m-%d'),
+ 'date_from': time.strftime('%Y-%m-01'),
'holiday_type': 'Validated',
}