[IMP]l10n_in_hr_payroll:code improved

bzr revid: kbh@tinyerp.com-20120809084238-h6vbx225ed3mxlv1
This commit is contained in:
Khushboo Bhatt (Open ERP) 2012-08-09 14:12:38 +05:30
parent 3cef19e555
commit 9c87c50576
1 changed files with 7 additions and 8 deletions

View File

@ -68,18 +68,18 @@ class report_hr_salary_employee_bymonth(report_sxw.rml_parse):
self.mnths.append('None')
return [mnth_name]
def get_salary(self, form, emp_id, emp_salary, total_mnths, category):
ids = []
category_ids = form.get('category_id', [])
ids.append(category_ids[0])
def get_salary(self, form, emp_id, emp_salary, total_mnths):
categories = form.get('category_id', [])
category_ids = []
category_ids.append(categories[0])
self.cr.execute("select to_char(date_to,'mm-yyyy') as to_date ,sum(pl.total) \
from hr_payslip_line as pl \
left join hr_payslip as p on pl.slip_id = p.id \
left join hr_employee as emp on emp.id = p.employee_id \
left join resource_resource as r on r.id = emp.resource_id \
where p.state = 'done' and p.employee_id = %s and pl.category_id in %s \
group by r.name, p.date_to,emp.id",(emp_id,tuple(ids),))
where p.state = 'done' and p.employee_id = %s and pl.category_id = %s \
group by r.name, p.date_to,emp.id",(emp_id,tuple(category_ids),))
sal = self.cr.fetchall()
salary = dict(sal)
total = 0.0
@ -105,7 +105,6 @@ class report_hr_salary_employee_bymonth(report_sxw.rml_parse):
emp_salary = []
salary_list = []
total_mnths=['Total', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
category = form.get('category_id', [])
emp_obj = self.pool.get('hr.employee')
emp_ids = form.get('employee_ids', [])
employees = emp_obj.browse(self.cr, self.uid, emp_ids, context=self.context)
@ -113,7 +112,7 @@ class report_hr_salary_employee_bymonth(report_sxw.rml_parse):
for emp_id in employees:
emp_salary.append(emp_id.name)
total = 0.0
emp_salary, total, total_mnths = self.get_salary(form, emp_id.id, emp_salary, total_mnths, category)
emp_salary, total, total_mnths = self.get_salary(form, emp_id.id, emp_salary, total_mnths)
emp_salary.append(total)
salary_list.append(emp_salary)
emp_salary = []