4
##############################################################################
6
# OpenERP, Open Source Management Solution
7
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
10
# This program is free software: you can redistribute it and/or modify
11
# it under the terms of the GNU General Public License as published by
12
# the Free Software Foundation, either version 3 of the License, or
13
# (at your option) any later version.
15
# This program is distributed in the hope that it will be useful,
16
# but WITHOUT ANY WARRANTY; without even the implied warranty of
17
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
# GNU General Public License for more details.
20
# You should have received a copy of the GNU General Public License
21
# along with this program. If not, see <http://www.gnu.org/licenses/>.
23
##############################################################################
27
from report import report_sxw
28
from tools import amount_to_text_en
30
class salary_structure_report(report_sxw.rml_parse):
32
def __init__(self, cr, uid, name, context):
33
super(salary_structure_report, self).__init__(cr, uid, name, context)
34
self.localcontext.update({
36
'get_type':self.get_type,
37
'get_contract':self.get_contract,
38
'get_line_amount_type':self.get_line_amount_type,
39
'get_line_type':self.get_line_type
42
def get_contract(self,emp):
43
curr_date = "'"+time.strftime("%Y-%m-%d")+"'"
45
SELECT c.id as id, c.wage as wage, function as function
47
LEFT JOIN hr_employee emp on (c.employee_id=emp.id)
48
LEFT JOIN hr_contract_wage_type cwt on (cwt.id = c.wage_type_id)
49
LEFT JOIN hr_contract_wage_type_period p on (cwt.period_id = p.id)
52
(date_start <= %s) AND
53
(date_end IS NULL OR date_end >= %s)
55
'''%(emp.id, curr_date, curr_date)
56
self.cr.execute(sql_req)
57
contract_id = self.cr.dictfetchone()
60
contract = self.pool.get('hr.contract').browse(self.cr, self.uid, [contract_id['id']])
63
def get_type(self,type):
64
return type[0].swapcase() + type[1:] +' Salary'
66
def get_line_amount_type(self,amount_type):
67
if amount_type == 'per':
72
def get_line_type(self,type):
73
if type == 'allounce':
75
elif type == 'deduction':
77
elif type == 'advance':
81
elif type == 'otherpay':
82
return 'Other Payment'
84
return 'Other Deduction'
86
report_sxw.report_sxw('report.salary.structure', 'hr.employee', 'hr_payroll/report/report_emp_salary_structure.rml', parser=salary_structure_report)