From 7fa1140ca62782ee298eb9250c1db7cde2a6a6d6 Mon Sep 17 00:00:00 2001 From: "Mustufa Rangwala (OpenERP)" Date: Thu, 26 Jul 2012 11:11:02 +0530 Subject: [PATCH] [IMP] l10n_in_hr_payroll: Improve Report of salary register bzr revid: mra@tinyerp.com-20120726054102-w4xqw5u08r3lg0ii --- .../report/report_hr_salary_employee_bymonth.py | 10 ++++------ .../wizard/hr_salary_employee_bymonth.py | 9 ++++----- .../wizard/hr_salary_employee_bymonth_view.xml | 11 +++-------- 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/addons/l10n_in_hr_payroll/report/report_hr_salary_employee_bymonth.py b/addons/l10n_in_hr_payroll/report/report_hr_salary_employee_bymonth.py index 6cc5d0068d0..f2c693ef6d1 100644 --- a/addons/l10n_in_hr_payroll/report/report_hr_salary_employee_bymonth.py +++ b/addons/l10n_in_hr_payroll/report/report_hr_salary_employee_bymonth.py @@ -69,12 +69,10 @@ class report_hr_salary_employee_bymonth(report_sxw.rml_parse): return [mnth_name] def get_salary(self, form, emp_id, emp_salary, total_mnths): -# Get salary of the employee - emp_obj = self.pool.get('hr.employee') - emp_ids = form.get('employee_ids', []) date_from = form.get('start_date', []) date_to = form.get('end_date', []) + emp_ids = form.get('employee_ids', []) employees = emp_obj.browse(self.cr, self.uid, emp_ids, context=self.context) self.cr.execute("select to_char(date_to,'mm-yyyy') as to_date ,sum(pl.total) as net \ @@ -82,8 +80,8 @@ class report_hr_salary_employee_bymonth(report_sxw.rml_parse): 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 pl.code = 'NET' and p.state = 'done' and p.employee_id in %s \ - group by r.name, p.date_to,emp.id",(tuple([emp_id]),)) + where pl.code = 'NET' and p.state = 'done' and p.employee_id = %s \ + group by r.name, p.date_to,emp.id",(emp_id,)) sal = self.cr.fetchall() salary = dict(sal) total = 0.0 @@ -103,7 +101,7 @@ class report_hr_salary_employee_bymonth(report_sxw.rml_parse): emp_salary.append('') total_mnths[cnt] = '' cnt = cnt + 1 - return emp_salary,total,total_mnths + return emp_salary, total, total_mnths def get_employee(self, form): emp_salary = [] diff --git a/addons/l10n_in_hr_payroll/wizard/hr_salary_employee_bymonth.py b/addons/l10n_in_hr_payroll/wizard/hr_salary_employee_bymonth.py index 172824a77cb..43bfa4da177 100644 --- a/addons/l10n_in_hr_payroll/wizard/hr_salary_employee_bymonth.py +++ b/addons/l10n_in_hr_payroll/wizard/hr_salary_employee_bymonth.py @@ -26,10 +26,10 @@ from osv import osv, fields class hr_salary_employee_bymonth(osv.osv_memory): _name = 'hr.salary.employee.month' - _description = 'Print Hr Salary Employee By Month Report' + _description = 'Hr Salary Employee By Month Report' _columns = { - 'start_date': fields.date('Starting Date', required=True), - 'end_date': fields.date('Ending Date', required=True), + 'start_date': fields.date('Start Date', required=True), + 'end_date': fields.date('End Date', required=True), 'employee_ids': fields.many2many('hr.employee', 'payroll_year_rel', 'payroll_year_id', 'emp_id', 'Employees', required=True), } @@ -53,8 +53,7 @@ class hr_salary_employee_bymonth(osv.osv_memory): res = self.read(cr, uid, ids, ['employee_ids', 'start_date', 'end_date'], context=context) res = res and res[0] or {} - datas['form'] = res - res['employee_ids'] = res.get('employee_ids', []) + datas.update({'form': res}) return { 'type': 'ir.actions.report.xml', 'report_name': 'salary.employee.bymonth', diff --git a/addons/l10n_in_hr_payroll/wizard/hr_salary_employee_bymonth_view.xml b/addons/l10n_in_hr_payroll/wizard/hr_salary_employee_bymonth_view.xml index bccacc05b33..2c73811f7f4 100644 --- a/addons/l10n_in_hr_payroll/wizard/hr_salary_employee_bymonth_view.xml +++ b/addons/l10n_in_hr_payroll/wizard/hr_salary_employee_bymonth_view.xml @@ -15,7 +15,7 @@ - + @@ -31,15 +31,10 @@ new - -