From 3e28c5fb00c2191af5f0e9f8368ef25203837ee4 Mon Sep 17 00:00:00 2001 From: "Khushboo Bhatt (Open ERP)" Date: Fri, 3 Aug 2012 11:49:02 +0530 Subject: [PATCH 01/12] [ADD]l10n_in_hr_payroll:added report for employee salary details by categories bzr revid: kbh@tinyerp.com-20120803061902-msvh29tr3fnog9tr --- addons/l10n_in_hr_payroll/__openerp__.py | 1 + .../l10n_in_hr_payroll_report.xml | 9 + addons/l10n_in_hr_payroll/report/__init__.py | 1 + .../report/report_yearly_salary_detail.py | 224 +++++++ .../report/report_yearly_salary_detail.rml | 563 ++++++++++++++++++ addons/l10n_in_hr_payroll/wizard/__init__.py | 1 + .../wizard/yearly_salary_detail.py | 66 ++ .../wizard/yearly_salary_detail_view.xml | 43 ++ 8 files changed, 908 insertions(+) create mode 100644 addons/l10n_in_hr_payroll/report/report_yearly_salary_detail.py create mode 100644 addons/l10n_in_hr_payroll/report/report_yearly_salary_detail.rml create mode 100644 addons/l10n_in_hr_payroll/wizard/yearly_salary_detail.py create mode 100644 addons/l10n_in_hr_payroll/wizard/yearly_salary_detail_view.xml diff --git a/addons/l10n_in_hr_payroll/__openerp__.py b/addons/l10n_in_hr_payroll/__openerp__.py index 1eca0d3ceba..4f5a54d8583 100644 --- a/addons/l10n_in_hr_payroll/__openerp__.py +++ b/addons/l10n_in_hr_payroll/__openerp__.py @@ -51,6 +51,7 @@ Indian Payroll Salary Rules. 'l10n_in_hr_payroll_report.xml', 'l10n_in_hr_payroll_sequence.xml', 'wizard/hr_salary_employee_bymonth_view.xml', + 'wizard/yearly_salary_detail_view.xml', 'report/payment_advice_report_view.xml', ], diff --git a/addons/l10n_in_hr_payroll/l10n_in_hr_payroll_report.xml b/addons/l10n_in_hr_payroll/l10n_in_hr_payroll_report.xml index 7604f34e32e..0b8df3880dd 100644 --- a/addons/l10n_in_hr_payroll/l10n_in_hr_payroll_report.xml +++ b/addons/l10n_in_hr_payroll/l10n_in_hr_payroll_report.xml @@ -25,5 +25,14 @@ name="salary.employee.bymonth" rml="l10n_in_hr_payroll/report/report_hr_salary_employee_bymonth.rml" string="Payroll Statement" /> + + + diff --git a/addons/l10n_in_hr_payroll/report/__init__.py b/addons/l10n_in_hr_payroll/report/__init__.py index 3091692c2e8..b8dfa2eeaaf 100644 --- a/addons/l10n_in_hr_payroll/report/__init__.py +++ b/addons/l10n_in_hr_payroll/report/__init__.py @@ -26,5 +26,6 @@ import report_payslip_details import report_payroll_advice import report_hr_salary_employee_bymonth import payment_advice_report +import report_yearly_salary_detail # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/l10n_in_hr_payroll/report/report_yearly_salary_detail.py b/addons/l10n_in_hr_payroll/report/report_yearly_salary_detail.py new file mode 100644 index 00000000000..7edd2e6d319 --- /dev/null +++ b/addons/l10n_in_hr_payroll/report/report_yearly_salary_detail.py @@ -0,0 +1,224 @@ +#-*- coding:utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2011 OpenERP SA (). All Rights Reserved +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +import time +import datetime +from report import report_sxw + +class employees_yearly_salary_report(report_sxw.rml_parse): + + def __init__(self, cr, uid, name, context): + super(employees_yearly_salary_report, self).__init__(cr, uid, name, context) + + self.localcontext.update({ + 'time': time, + 'get_employee': self.get_employee, + 'get_employee_detail': self.get_employee_detail, + 'cal_monthly_amt': self.cal_monthly_amt, + 'get_periods': self.get_periods, + 'get_total': self.get_total, + 'get_allow': self.get_allow, + 'get_deduct': self.get_deduct, + }) + + self.context = context + self.mnths = [] + self.allow_list = [] + self.deduct_list = [] + self.other_list = [] + self.month_total_list = [] + self.total = 0.00 + + def get_periods(self, form): +# Get start year-month-date and end year-month-date + first_year = int(form['date_from'][0:4]) + last_year = int(form['date_to'][0:4]) + + first_month = int(form['date_from'][5:7]) + last_month = int(form['date_to'][5:7]) + no_months = (last_year-first_year) * 12 + last_month - first_month + 1 + current_month = first_month + current_year = first_year + +# Get name of the months from integer + mnth_name = [] + for count in range(0, no_months): + m = datetime.date(current_year, current_month, 1).strftime('%b') + mnth_name.append(m) + self.mnths.append(str(current_month) + '-' + str(current_year)) + if current_month == 12: + current_month = 0 + current_year = last_year + current_month = current_month + 1 + for c in range(0, (12-no_months)): + mnth_name.append('None') + self.mnths.append('None') + return [mnth_name] + + def get_employee(self, form): + result = [] + emp_obj = self.pool.get('hr.employee') + emp_ids = form.get('employee_ids', []) + result = emp_obj.browse(self.cr,self.uid, emp_ids, context=self.context) + return result + + def get_employee_detail(self, form, obj): + self.allow_list = [] + self.deduct_list = [] + self.total = 0.00 + + #for Basic Salary + res = self.cal_monthly_amt(form, obj.id) + basic = res[0] + self.total += basic[0][len(basic[0])-1] + self.allow_list.append(basic[0]) + + #for allowance + allow = res[1] + gross = res[3] + for i in range(1, len(allow)+1): + self.allow_list.append(allow[i-1]) + self.total += allow[i-1][len(allow[i-1])-1] + self.total += gross[0][len(gross[0])-1] + self.allow_list.append(gross[0]) + + #for Deduction + deduct = res[2] + net = res[4] + for i in range(1, len(deduct)+1): + self.deduct_list.append(deduct[i-1]) + self.total -= deduct[i-1][len(deduct[i-1])-1] + self.total += net[0][len(net[0])-1] + self.deduct_list.append(net[0]) + return None + + def cal_monthly_amt(self, form, emp_id): + + result = [] + salaries = {} + tot = 0.0 + + payslip_line_obj = self.pool.get('hr.payslip.line') + + line_ids = payslip_line_obj.search(self.cr, self.uid, [], context=self.context) + lines = payslip_line_obj.browse(self.cr, self.uid, line_ids, context=self.context) + + self.cr.execute('''SELECT rc.code, pl.name, sum(pl.total), \ + to_char(date_to,'mm-yyyy') as to_date FROM hr_payslip_line as pl \ + LEFT JOIN hr_salary_rule_category AS rc on (pl.category_id = rc.id) \ + LEFT JOIN hr_payslip as p on pl.slip_id = p.id \ + LEFT JOIN hr_employee as emp on emp.id = p.employee_id \ + WHERE pl.id in %s and p.employee_id = %s \ + GROUP BY rc.parent_id, pl.sequence, pl.id, pl.category_id,pl.name,p.date_to,rc.code \ + ORDER BY pl.sequence, rc.parent_id''',(tuple(line_ids),emp_id)) + sal = self.cr.fetchall() + + for x in sal: + if x[0] == 'BASIC': + if x[0] not in salaries: + salaries[x[0]] = {} + salaries[x[0]].update({x[1]: {x[3]: x[2]}}) + elif x[1] not in salaries[x[0]]: + salaries[x[0]][x[1]] = {} + salaries[x[0]][x[1]].update({x[3]: x[2]}) + else: + salaries[x[0]][x[1]].update({x[3]: x[2]}) + if x[0] == 'ALW': + if x[0] not in salaries: + salaries[x[0]] = {} + salaries[x[0]].update({x[1]: {x[3]: x[2]}}) + elif x[1] not in salaries[x[0]]: + salaries[x[0]][x[1]] = {} + salaries[x[0]][x[1]].update({x[3]: x[2]}) + else: + salaries[x[0]][x[1]].update({x[3]: x[2]}) + if x[0] == 'DED': + if x[0] not in salaries: + salaries[x[0]] = {} + salaries[x[0]].update({x[1]: {x[3]: x[2]}}) + elif x[1] not in salaries[x[0]]: + salaries[x[0]][x[1]] = {} + salaries[x[0]][x[1]].update({x[3]: x[2]}) + else: + salaries[x[0]][x[1]].update({x[3]: x[2]}) + if x[0] == 'GROSS': + if x[0] not in salaries: + salaries[x[0]] = {} + salaries[x[0]].update({x[1]: {x[3]: x[2]}}) + elif x[1] not in salaries[x[0]]: + salaries[x[0]][x[1]] = {} + salaries[x[0]][x[1]].update({x[3]: x[2]}) + else: + salaries[x[0]][x[1]].update({x[3]: x[2]}) + if x[0] == 'NET': + if x[0] not in salaries: + salaries[x[0]] = {} + salaries[x[0]].update({x[1]: {x[3]: x[2]}}) + elif x[1] not in salaries[x[0]]: + salaries[x[0]][x[1]] = {} + salaries[x[0]][x[1]].update({x[3]: x[2]}) + else: + salaries[x[0]][x[1]].update({x[3]: x[2]}) + + for code in ['BASIC', 'ALW', 'DED', 'GROSS', 'NET']: + if code in salaries: + res = self.salary_list(salaries[code]) + else: + res = [] + result.append(res) + return result + + def salary_list(self, salaries): + cnt = 0 + cat_salary_all = [] + for category_name,amount in salaries.items(): + cat_salary = [] + cnt += 1 + tot = 0.0 + cat_salary.append(category_name) + for mnth in self.mnths: + if mnth <> 'None': + if len(mnth) != 7: + mnth = '0' + str(mnth) + if mnth in amount and amount[mnth]: + cat_salary.append(amount[mnth]) + tot += amount[mnth] + else: + cat_salary.append(0.00) + else: + cat_salary.append('') + cat_salary.append(tot) + cat_salary_all.append(cat_salary) + cnt = 1 + return cat_salary_all + + def get_allow(self): + return self.allow_list + + def get_deduct(self): + return self.deduct_list + + def get_total(self): + return self.total + +report_sxw.report_sxw('report.salary.detail.byyear', 'yearly.salary.detail', 'hr_payroll/report/report_yearly_salary_detail.rml', parser=employees_yearly_salary_report, header='internal landscape') + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/l10n_in_hr_payroll/report/report_yearly_salary_detail.rml b/addons/l10n_in_hr_payroll/report/report_yearly_salary_detail.rml new file mode 100644 index 00000000000..0f150d56575 --- /dev/null +++ b/addons/l10n_in_hr_payroll/report/report_yearly_salary_detail.rml @@ -0,0 +1,563 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [[ repeatIn(get_employee(data['form']), 'o') ]] + + + + Employees Salary Details + From [[ formatLang(data['form']['date_from'], date=True) ]] To [[ formatLang(data['form']['date_to'], date=True) ]] + + + + + + + + + + Employee Code + + + [[ o.ssnid ]] + + + Department + + + [[ o.company_id and o.company_id.name or '' ]] + + + Bank + + + [[ o.otherid or '' ]] + + + + + + + Employee Name + + + [[ o.name ]] + + + Other No. + + + [[ o.otherid or '' ]] + + + Address + + + [[o.address_home_id and o.address_home_id.name or '' ]] + + + + + + + Designation + + + [[ o.contract_ids and o.contract_ids[0].job_id.name or '' ]] + + + Phone No. + + + [[ o.work_phone or '' ]] + + + E-mail Address + + + [[o.work_email or '' ]] + + + + + + +
+ [[ repeatIn(get_periods(data['form']),'m') ]] [[ get_employee_detail((data['form']),o) ]] + + + + Title + + + [[ m[0] != 'None' and m[0] or '' ]] + + + [[ m[1] != 'None' and m[1] or '' ]] + + + [[ m[2] != 'None' and m[2] or '' ]] + + + [[ m[3] != 'None' and m[3] or '' ]] + + + [[ m[4] != 'None' and m[4] or '' ]] + + + [[ m[5] != 'None' and m[5] or '' ]] + + + [[ m[6] != 'None' and m[6] or '' ]] + + + [[ m[7] != 'None' and m[7] or '' ]] + + + [[ m[8] != 'None' and m[8] or '' ]] + + + [[ m[9] != 'None' and m[9] or '' ]] + + + [[ m[10] != 'None' and m[10] or '' ]] + + + [[ m[11] != 'None' and m[11] or '' ]] + + + Total + + + + + + +
+ + + + Allowances with Basic: + + + +
+ [[ repeatIn(get_allow(),'e1') ]] + + + + [[ e1[0] ]] + + + + [[ (e1[1]!='' and formatLang(e1[1])) or removeParentNode('font') ]] + + + + + [[ (e1[2]!='' and formatLang(e1[2])) or removeParentNode('font') ]] + + + + + [[ (e1[3]!='' and formatLang(e1[3])) or removeParentNode('font') ]] + + + + + [[ (e1[4]!='' and formatLang(e1[4])) or removeParentNode('font') ]] + + + + + [[ (e1[5]!='' and formatLang(e1[5])) or removeParentNode('font') ]] + + + + + [[ (e1[6]!='' and formatLang(e1[6])) or removeParentNode('font') ]] + + + + + [[ (e1[7]!='' and formatLang(e1[7])) or removeParentNode('font') ]] + + + + + [[ (e1[8]!='' and formatLang(e1[8])) or removeParentNode('font') ]] + + + + + [[ (e1[9]!='' and formatLang(e1[9])) or removeParentNode('font') ]] + + + + + [[ (e1[10]!='' and formatLang(e1[10])) or removeParentNode('font') ]] + + + + + [[ (e1[11]!='' and formatLang(e1[11])) or removeParentNode('font') ]] + + + + + [[ (e1[12]!='' and formatLang(e1[12])) or removeParentNode('font') ]] + + + + [[ formatLang(e1[13]) ]] [[ company.currency_id.symbol ]] + + + +
+ + + + Deductions: + + + +
+ [[ repeatIn(get_deduct(),'e2') ]] + + + + [[ e2[0] ]] + + + + [[ (e2[1]!='' and formatLang(e2[1])) or removeParentNode('font') ]] + + + + + [[ (e2[2]!='' and formatLang(e2[2])) or removeParentNode('font') ]] + + + + + [[ (e2[3]!='' and formatLang(e2[3])) or removeParentNode('font') ]] + + + + + [[ (e2[4]!='' and formatLang(e2[4])) or removeParentNode('font') ]] + + + + + [[ (e2[5]!='' and formatLang(e2[5])) or removeParentNode('font') ]] + + + + + [[ (e2[6]!='' and formatLang(e2[6])) or removeParentNode('font') ]] + + + + + [[ (e2[7]!='' and formatLang(e2[7])) or removeParentNode('font') ]] + + + + + [[ (e2[8]!='' and formatLang(e2[8])) or removeParentNode('font') ]] + + + + + [[ (e2[9]!='' and formatLang(e2[9])) or removeParentNode('font') ]] + + + + + [[ (e2[10]!='' and formatLang(e2[10])) or removeParentNode('font') ]] + + + + + [[ (e2[11]!='' and formatLang(e2[11])) or removeParentNode('font') ]] + + + + + [[ (e2[12]!='' and formatLang(e2[12])) or removeParentNode('font') ]] + + + + [[ formatLang(e2[13]) ]] [[ company.currency_id.symbol ]] + + + +
+
+ + + +
+ + + +
+
diff --git a/addons/l10n_in_hr_payroll/wizard/__init__.py b/addons/l10n_in_hr_payroll/wizard/__init__.py index b08ed5a3f9c..358c0cfa906 100644 --- a/addons/l10n_in_hr_payroll/wizard/__init__.py +++ b/addons/l10n_in_hr_payroll/wizard/__init__.py @@ -20,5 +20,6 @@ ############################################################################## import hr_salary_employee_bymonth +import yearly_salary_detail # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/l10n_in_hr_payroll/wizard/yearly_salary_detail.py b/addons/l10n_in_hr_payroll/wizard/yearly_salary_detail.py new file mode 100644 index 00000000000..1329d5a2ed7 --- /dev/null +++ b/addons/l10n_in_hr_payroll/wizard/yearly_salary_detail.py @@ -0,0 +1,66 @@ +#-*- coding:utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2011 OpenERP SA (). All Rights Reserved +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +import time + +from osv import fields, osv + +class yearly_salary_detail(osv.osv_memory): + + _name ='yearly.salary.detail' + _description = 'Hr Salary Employee By Category Report' + _columns = { + 'employee_ids': fields.many2many('hr.employee', 'payroll_emp_rel', 'payroll_id', 'emp_id', 'Employees', required=True), + 'date_from': fields.date('Start Date', required=True), + 'date_to': fields.date('End Date', required=True), + } + + _defaults = { + 'date_from': lambda *a: time.strftime('%Y-01-01'), + 'date_to': lambda *a: time.strftime('%Y-%m-%d'), + + } + + def print_report(self, cr, uid, ids, context=None): + """ + To get the date and print the report + @param self: The object pointer. + @param cr: A database cursor + @param uid: ID of the user currently logged in + @param context: A standard dictionary + @return: return report + """ + if context is None: + context = {} + datas = {'ids': context.get('active_ids', [])} + + res = self.read(cr, uid, ids, ['employee_ids', 'date_from', 'date_to'], context=context) + res = res and res[0] or {} + datas.update({'form': res}) + return { + 'type': 'ir.actions.report.xml', + 'report_name': 'salary.detail.byyear', + 'datas': datas, + } + +yearly_salary_detail() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/l10n_in_hr_payroll/wizard/yearly_salary_detail_view.xml b/addons/l10n_in_hr_payroll/wizard/yearly_salary_detail_view.xml new file mode 100644 index 00000000000..a2369895237 --- /dev/null +++ b/addons/l10n_in_hr_payroll/wizard/yearly_salary_detail_view.xml @@ -0,0 +1,43 @@ + + + + + Employee Yearly Salary + yearly.salary.detail + form + +
+
+
+ + + + + + +
+
+
+ + + Employee Yearly Salary + ir.actions.act_window + yearly.salary.detail + form + form + new + + + + +
+
From a7232ac79f4d8e6cbf09338864f8a9b4dc02aa16 Mon Sep 17 00:00:00 2001 From: "Khushboo Bhatt (Open ERP)" Date: Fri, 3 Aug 2012 11:59:30 +0530 Subject: [PATCH 02/12] [REM]l10n_in_hr_payroll:unnesesary list removed bzr revid: kbh@tinyerp.com-20120803062930-u2hsy4m8s3nqfy9x --- addons/l10n_in_hr_payroll/report/report_yearly_salary_detail.py | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/l10n_in_hr_payroll/report/report_yearly_salary_detail.py b/addons/l10n_in_hr_payroll/report/report_yearly_salary_detail.py index 7edd2e6d319..217c06a8031 100644 --- a/addons/l10n_in_hr_payroll/report/report_yearly_salary_detail.py +++ b/addons/l10n_in_hr_payroll/report/report_yearly_salary_detail.py @@ -43,7 +43,6 @@ class employees_yearly_salary_report(report_sxw.rml_parse): self.mnths = [] self.allow_list = [] self.deduct_list = [] - self.other_list = [] self.month_total_list = [] self.total = 0.00 From 498f0ae6ea039287541d1e5c629998de041315bf Mon Sep 17 00:00:00 2001 From: "Khushboo Bhatt (Open ERP)" Date: Fri, 3 Aug 2012 12:09:00 +0530 Subject: [PATCH 03/12] [REM]l10n_in_hr_payroll:unnesesary list removed bzr revid: kbh@tinyerp.com-20120803063900-j31qbhjmsecojbke --- addons/l10n_in_hr_payroll/report/report_yearly_salary_detail.py | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/l10n_in_hr_payroll/report/report_yearly_salary_detail.py b/addons/l10n_in_hr_payroll/report/report_yearly_salary_detail.py index 217c06a8031..15c7279c477 100644 --- a/addons/l10n_in_hr_payroll/report/report_yearly_salary_detail.py +++ b/addons/l10n_in_hr_payroll/report/report_yearly_salary_detail.py @@ -43,7 +43,6 @@ class employees_yearly_salary_report(report_sxw.rml_parse): self.mnths = [] self.allow_list = [] self.deduct_list = [] - self.month_total_list = [] self.total = 0.00 def get_periods(self, form): From 2386cb96c98edaa805cdf83af654494abdf4ccb6 Mon Sep 17 00:00:00 2001 From: "Khushboo Bhatt (Open ERP)" Date: Fri, 3 Aug 2012 14:47:29 +0530 Subject: [PATCH 04/12] [FIX]l10n_in_hr_payroll:report name changed,file name changed,rml improved bzr revid: kbh@tinyerp.com-20120803091729-sal3w4dltoxbxu5w --- addons/l10n_in_hr_payroll/__openerp__.py | 2 +- .../l10n_in_hr_payroll_report.xml | 4 +- addons/l10n_in_hr_payroll/report/__init__.py | 2 +- ...l.py => report_hr_yearly_salary_detail.py} | 21 ++++--- ...rml => report_hr_yearly_salary_detail.rml} | 63 ++++++++++--------- addons/l10n_in_hr_payroll/wizard/__init__.py | 2 +- ...y_detail.py => hr_yearly_salary_detail.py} | 0 ...w.xml => hr_yearly_salary_detail_view.xml} | 4 +- 8 files changed, 50 insertions(+), 48 deletions(-) rename addons/l10n_in_hr_payroll/report/{report_yearly_salary_detail.py => report_hr_yearly_salary_detail.py} (94%) rename addons/l10n_in_hr_payroll/report/{report_yearly_salary_detail.rml => report_hr_yearly_salary_detail.rml} (92%) rename addons/l10n_in_hr_payroll/wizard/{yearly_salary_detail.py => hr_yearly_salary_detail.py} (100%) rename addons/l10n_in_hr_payroll/wizard/{yearly_salary_detail_view.xml => hr_yearly_salary_detail_view.xml} (93%) diff --git a/addons/l10n_in_hr_payroll/__openerp__.py b/addons/l10n_in_hr_payroll/__openerp__.py index 4f5a54d8583..199dc0a232c 100644 --- a/addons/l10n_in_hr_payroll/__openerp__.py +++ b/addons/l10n_in_hr_payroll/__openerp__.py @@ -51,7 +51,7 @@ Indian Payroll Salary Rules. 'l10n_in_hr_payroll_report.xml', 'l10n_in_hr_payroll_sequence.xml', 'wizard/hr_salary_employee_bymonth_view.xml', - 'wizard/yearly_salary_detail_view.xml', + 'wizard/hr_yearly_salary_detail_view.xml', 'report/payment_advice_report_view.xml', ], diff --git a/addons/l10n_in_hr_payroll/l10n_in_hr_payroll_report.xml b/addons/l10n_in_hr_payroll/l10n_in_hr_payroll_report.xml index 0b8df3880dd..4a0c9ded0b9 100644 --- a/addons/l10n_in_hr_payroll/l10n_in_hr_payroll_report.xml +++ b/addons/l10n_in_hr_payroll/l10n_in_hr_payroll_report.xml @@ -31,8 +31,8 @@ id="yearly_salary" model="yearly.salary.detail" name="salary.detail.byyear" - rml="l10n_in_hr_payroll/report/report_yearly_salary_detail.rml" - string="Yearly Salary Report" /> + rml="l10n_in_hr_payroll/report/report_hr_yearly_salary_detail.rml" + string="Payroll Register" /> diff --git a/addons/l10n_in_hr_payroll/report/__init__.py b/addons/l10n_in_hr_payroll/report/__init__.py index b8dfa2eeaaf..5c76aa37e1c 100644 --- a/addons/l10n_in_hr_payroll/report/__init__.py +++ b/addons/l10n_in_hr_payroll/report/__init__.py @@ -26,6 +26,6 @@ import report_payslip_details import report_payroll_advice import report_hr_salary_employee_bymonth import payment_advice_report -import report_yearly_salary_detail +import report_hr_yearly_salary_detail # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/l10n_in_hr_payroll/report/report_yearly_salary_detail.py b/addons/l10n_in_hr_payroll/report/report_hr_yearly_salary_detail.py similarity index 94% rename from addons/l10n_in_hr_payroll/report/report_yearly_salary_detail.py rename to addons/l10n_in_hr_payroll/report/report_hr_yearly_salary_detail.py index 15c7279c477..c642e297de5 100644 --- a/addons/l10n_in_hr_payroll/report/report_yearly_salary_detail.py +++ b/addons/l10n_in_hr_payroll/report/report_hr_yearly_salary_detail.py @@ -46,6 +46,7 @@ class employees_yearly_salary_report(report_sxw.rml_parse): self.total = 0.00 def get_periods(self, form): + self.mnths =[] # Get start year-month-date and end year-month-date first_year = int(form['date_from'][0:4]) last_year = int(form['date_to'][0:4]) @@ -86,8 +87,9 @@ class employees_yearly_salary_report(report_sxw.rml_parse): #for Basic Salary res = self.cal_monthly_amt(form, obj.id) basic = res[0] - self.total += basic[0][len(basic[0])-1] - self.allow_list.append(basic[0]) + if basic: + self.total += basic[0][len(basic[0])-1] + self.allow_list.append(basic[0]) #for allowance allow = res[1] @@ -95,8 +97,9 @@ class employees_yearly_salary_report(report_sxw.rml_parse): for i in range(1, len(allow)+1): self.allow_list.append(allow[i-1]) self.total += allow[i-1][len(allow[i-1])-1] - self.total += gross[0][len(gross[0])-1] - self.allow_list.append(gross[0]) + if gross: + self.total += gross[0][len(gross[0])-1] + self.allow_list.append(gross[0]) #for Deduction deduct = res[2] @@ -104,8 +107,9 @@ class employees_yearly_salary_report(report_sxw.rml_parse): for i in range(1, len(deduct)+1): self.deduct_list.append(deduct[i-1]) self.total -= deduct[i-1][len(deduct[i-1])-1] - self.total += net[0][len(net[0])-1] - self.deduct_list.append(net[0]) + if net: + self.total += net[0][len(net[0])-1] + self.deduct_list.append(net[0]) return None def cal_monthly_amt(self, form, emp_id): @@ -185,11 +189,9 @@ class employees_yearly_salary_report(report_sxw.rml_parse): return result def salary_list(self, salaries): - cnt = 0 cat_salary_all = [] for category_name,amount in salaries.items(): cat_salary = [] - cnt += 1 tot = 0.0 cat_salary.append(category_name) for mnth in self.mnths: @@ -205,7 +207,6 @@ class employees_yearly_salary_report(report_sxw.rml_parse): cat_salary.append('') cat_salary.append(tot) cat_salary_all.append(cat_salary) - cnt = 1 return cat_salary_all def get_allow(self): @@ -217,6 +218,6 @@ class employees_yearly_salary_report(report_sxw.rml_parse): def get_total(self): return self.total -report_sxw.report_sxw('report.salary.detail.byyear', 'yearly.salary.detail', 'hr_payroll/report/report_yearly_salary_detail.rml', parser=employees_yearly_salary_report, header='internal landscape') +report_sxw.report_sxw('report.salary.detail.byyear', 'yearly.salary.detail', 'hr_payroll/report/report_hr_yearly_salary_detail.rml', parser=employees_yearly_salary_report, header='internal landscape') # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/l10n_in_hr_payroll/report/report_yearly_salary_detail.rml b/addons/l10n_in_hr_payroll/report/report_hr_yearly_salary_detail.rml similarity index 92% rename from addons/l10n_in_hr_payroll/report/report_yearly_salary_detail.rml rename to addons/l10n_in_hr_payroll/report/report_hr_yearly_salary_detail.rml index 0f150d56575..3a9412d7008 100644 --- a/addons/l10n_in_hr_payroll/report/report_yearly_salary_detail.rml +++ b/addons/l10n_in_hr_payroll/report/report_hr_yearly_salary_detail.rml @@ -1,6 +1,6 @@ - -