diff --git a/addons/hr_payroll/report/report_emp_salary_structure.py b/addons/hr_payroll/report/report_emp_salary_structure.py index 7deafcf63e4..e875e774b43 100644 --- a/addons/hr_payroll/report/report_emp_salary_structure.py +++ b/addons/hr_payroll/report/report_emp_salary_structure.py @@ -33,32 +33,32 @@ class salary_structure_report(report_sxw.rml_parse): self.localcontext.update({ 'time': time, 'get_type':self.get_type, - 'get_contract':self.get_contract, + #'get_contract':self.get_contract, 'get_line_amount_type':self.get_line_amount_type, 'get_line_type':self.get_line_type, 'get_line_amount_symbol':self.get_line_amount_symbol }) - def get_contract(self,emp): - curr_date = "'"+time.strftime("%Y-%m-%d")+"'" - sql_req= ''' - SELECT c.id as id, c.wage as wage, struct_id as struct - FROM hr_contract c - LEFT JOIN hr_employee emp on (c.employee_id=emp.id) - LEFT JOIN hr_contract_wage_type cwt on (cwt.id = c.wage_type_id) - LEFT JOIN hr_contract_wage_type_period p on (cwt.period_id = p.id) - WHERE - (emp.id=%s) AND - (date_start <= %s) AND - (date_end IS NULL OR date_end >= %s) - LIMIT 1 - '''%(emp.id, curr_date, curr_date) - self.cr.execute(sql_req) - contract_id = self.cr.dictfetchone() - if not contract_id: - return [] - contract = self.pool.get('hr.contract').browse(self.cr, self.uid, [contract_id['id']]) - return contract +# def get_contract(self,emp): +# curr_date = "'"+time.strftime("%Y-%m-%d")+"'" +# sql_req= ''' +# SELECT c.id as id, c.wage as wage, struct_id as struct +# FROM hr_contract c +# LEFT JOIN hr_employee emp on (c.employee_id=emp.id) +# LEFT JOIN hr_contract_wage_type cwt on (cwt.id = c.wage_type_id) +# LEFT JOIN hr_contract_wage_type_period p on (cwt.period_id = p.id) +# WHERE +# (emp.id=%s) AND +# (date_start <= %s) AND +# (date_end IS NULL OR date_end >= %s) +# LIMIT 1 +# '''%(emp.id, curr_date, curr_date) +# self.cr.execute(sql_req) +# contract_id = self.cr.dictfetchone() +# if not contract_id: +# return [] +# contract = self.pool.get('hr.contract').browse(self.cr, self.uid, [contract_id['id']]) +# return contract def get_type(self,type): return type[0].swapcase() + type[1:] +' Salary' diff --git a/addons/hr_payroll/report/report_emp_salary_structure.rml b/addons/hr_payroll/report/report_emp_salary_structure.rml index 1ccc327063e..20bdae2442e 100644 --- a/addons/hr_payroll/report/report_emp_salary_structure.rml +++ b/addons/hr_payroll/report/report_emp_salary_structure.rml @@ -267,7 +267,7 @@
- [[repeatIn(get_contract(employee),'cont')]] + [[ not employee.contract_id and removeParentNode('section') ]] @@ -318,7 +318,7 @@ Designation - [[ cont.job_id.name or '' ]] + [[ employee.contract_id and employee.contract_id.job_id and employee.contract_id.job_id.name or '' ]] Phone No. @@ -334,7 +334,7 @@ - + @@ -356,19 +356,19 @@ Start Date - [[ formatLang(cont.date_start,date=True) or '' ]] + [[ employee.contract_id and formatLang(employee.contract_id.date_start,date=True) or '' ]] End Date - [[ formatLang(cont.date_end,date=True) or removeParentNode('para') ]] + [[ employee.contract_id and formatLang(employee.contract_id.date_end,date=True) or removeParentNode('para') ]] Type - [[ get_type(cont.wage_type_id.type) or '' ]] + [[ employee.contract_id and get_type(employee.contract_id.wage_type_id.type) or '' ]] @@ -378,13 +378,13 @@ Salary - [[ formatLang(cont.wage) or '' ]] [[ employee.company_id.currency_id.symbol]] + [[ employee.contract_id and formatLang(employee.contract_id.wage) or '' ]] [[ employee.company_id.currency_id.symbol]] Notes: - [[ cont.notes or '' ]] + [[ employee.contract_id and employee.contract_id.notes or '' ]] @@ -394,19 +394,19 @@ Basic - [[ cont.basic ]] [[ employee.company_id.currency_id.symbol ]] + [[ employee.basic ]] [[ employee.company_id.currency_id.symbol ]] Allowances - [[ cont.advantages_gross ]] [[ employee.company_id.currency_id.symbol ]] + [[ employee.advantages_gross ]] [[ employee.company_id.currency_id.symbol ]] Gross Salary - [[ cont.gross ]] [[ employee.company_id.currency_id.symbol ]] + [[ employee.gross ]] [[ employee.company_id.currency_id.symbol ]] @@ -416,17 +416,17 @@ Deductions - [[ cont.advantages_net ]] [[ employee.company_id.currency_id.symbol ]] + [[ employee.advantages_net ]] [[ employee.company_id.currency_id.symbol ]] Net Salary - [[ cont.net ]] [[ employee.company_id.currency_id.symbol ]] + [[ employee.net ]] [[ employee.company_id.currency_id.symbol ]] - + @@ -463,7 +463,7 @@
- [[repeatIn(cont.struct_id.line_ids,'line')]] + [[repeatIn(employee.contract_id and employee.contract_id.struct_id and employee.contract_id.struct_id.line_ids or [],'line')]] @@ -473,7 +473,7 @@ [[ line.name ]] - [[ formatLang(line.amount) or '']][[ get_line_amount_symbol(line.amount_type) ]] + [[ line.amount or '']] [[ get_line_amount_symbol(line.amount_type) ]] [[ get_line_amount_type(line.amount_type) ]] @@ -489,7 +489,7 @@
- + @@ -536,7 +536,7 @@ [[ line1.name ]] - [[ formatLang(line1.amount) ]] + [[ line1.amount ]] [[ get_line_amount_symbol(line1.amount_type) ]] [[ get_line_amount_type(line1.amount_type) ]]