[ADD]l10n_in_hr_payroll:added report for salary rule by months

bzr revid: kbh@tinyerp.com-20120718131502-csfajf5yeqjsby07
This commit is contained in:
Khushboo Bhatt (Open ERP) 2012-07-18 18:45:02 +05:30
parent c06b2854f7
commit 5f91b11c1c
12 changed files with 589 additions and 5 deletions

View File

@ -37,7 +37,6 @@ class payslip_details_report(report_sxw.rml_parse):
def get_details_by_rule_category(self, obj):
payslip_line = self.pool.get('hr.payslip.line')
rule_cate_obj = self.pool.get('hr.salary.rule.category')
def get_recursive_parent(rule_categories):
if not rule_categories:
return []

View File

@ -21,5 +21,6 @@
import l10n_in_hr_payroll
import report
import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -49,7 +49,8 @@ Indian Payroll Salary Rules.
'data/hr.salary.rule.csv',
'security/ir.model.access.csv',
'l10n_in_hr_payroll_report.xml',
'l10n_in_hr_payroll_sequence.xml'
'l10n_in_hr_payroll_sequence.xml',
'wizard/salary_rule_bymonth.xml'
],
'demo_xml': ['l10n_in_hr_payroll_demo.xml'],
'installable': True

View File

@ -17,6 +17,13 @@
name="payroll.advice"
rml="l10n_in_hr_payroll/report/report_payroll_advice.rml"
string="Print Advice" />
<report
auto="False"
id="salary_rule_bymonth"
model="salary.rule.month"
name="salary.rule.bymonth"
rml="l10n_in_hr_payroll/report/report_salary_rule_bymonth.rml"
string="rule by month" />
</data>
</openerp>

View File

@ -24,5 +24,6 @@
import report_payslip_details
import report_payroll_advice
import report_salary_rule_bymonth
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,8 +1,8 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
<template title="Invoices" author="OpenERP S.A.(sales@openerp.com)" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="28.0" y1="28.0" width="539" height="786"/>
<frame id="first" x1="34.0" y1="28.0" width="530" height="786"/>
</pageTemplate>
</template>
<stylesheet>

View File

@ -25,6 +25,7 @@ from hr_payroll import report
class payslip_details_report_in(report.report_payslip_details.payslip_details_report):
def __init__(self, cr, uid, name, context):
print "initttttttttttttttttttt"
super(payslip_details_report_in, self).__init__(cr, uid, name, context)
self.localcontext.update({
'get_details_by_rule_category': self.get_details_by_rule_category,

View File

@ -0,0 +1,127 @@
#-*- coding:utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# d$
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
import datetime
from report import report_sxw
import time
import pooler
class report_salary_rule_bymonth(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(report_salary_rule_bymonth, self).__init__(cr, uid, name, context)
self.localcontext.update({
'time': time,
'get_employee': self.get_employee,
'get_periods': self.get_periods,
'get_months_tol': self.get_months_tol,
'get_total': self.get_total,
})
self.mnths =[]
self.mnths_tol = []
self.total=0.0
def get_periods(self,form):
# Get start year-month-date and end year-month-date
fy = int(form['start_date'][0:4])
ly = int(form['end_date'][0:4])
fm = int(form['start_date'][5:7])
lm = int(form['end_date'][5:7])
no_months = (ly-fy)*12+lm-fm + 1
cm = fm
cy = fy
# Get name of the months from integer
mnth_name = []
for count in range(0,no_months):
m = datetime.date(cy, cm, 1).strftime('%b')
mnth_name.append(m)
self.mnths.append(str(cm)+'-'+str(cy))
if cm == 12:
cm = 0
cy = ly
cm = cm +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):
ls1=[]
ls = []
tol_mnths=['Total',0,0,0,0,0,0,0,0,0,0,0,0]
emp = pooler.get_pool(self.cr.dbname).get('hr.employee')
emp_ids = form['employee_ids']
empll = emp.browse(self.cr,self.uid, emp_ids)
cnt = 1
for emp_id in empll:
ls1.append(emp_id.name)
tol = 0.0
for mnth in self.mnths:
if mnth <> 'None':
if len(mnth) != 7:
mnth = '0' + str(mnth)
self.cr.execute('''select 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 (pl.code = 'NET') and p.employee_id = '''+str(emp_id.id)+''' \
and to_char(date_to,'mm-yyyy') like '%'''+mnth+'''%'
group by r.name, p.date_to,emp.id''')
# self.cr.execute(query)
sal = self.cr.fetchall()
if sal:
ls1.append(sal[0][0])
tol += sal[0][0]
tol_mnths[cnt] = tol_mnths[cnt] + sal[0][0]
else:
ls1.append(0.00)
tol_mnths[cnt] = 0.0
else:
ls1.append('')
tol_mnths[cnt] = ''
cnt = cnt + 1
cnt = 1
ls1.append(tol)
ls.append(ls1)
ls1 = []
self.mnths_tol.append(tol_mnths)
return ls
def get_months_tol(self):
return self.mnths_tol
def get_total(self):
for item in self.mnths_tol:
for count in range(1,len(item)):
if item[count] == '':
continue
self.total += item[count]
return self.total
report_sxw.report_sxw('report.salary.rule.bymonth', 'salary.rule.month', 'l10n_in_hr_payroll/report/report_salary_rule_bymonth.rml', parser=report_salary_rule_bymonth)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,302 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="28.0" y1="28.0" width="400" height="786"/>
</pageTemplate>
</template>
<stylesheet>
<blockTableStyle id="Standard_Outline">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
</blockTableStyle>
<blockTableStyle id="Table1">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="4,0" stop="4,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="5,0" stop="5,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="6,0" stop="6,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="6,-1" stop="6,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="7,0" stop="7,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="7,-1" stop="7,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="8,0" stop="8,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="8,-1" stop="8,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="9,0" stop="9,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="9,-1" stop="9,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="10,0" stop="10,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="10,-1" stop="10,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="11,0" stop="11,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="11,-1" stop="11,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="12,0" stop="12,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="12,-1" stop="12,-1"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="13,0" stop="13,0"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="13,-1" stop="13,-1"/>
</blockTableStyle>
<blockTableStyle id="Table2">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="5,-1" stop="5,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="6,-1" stop="6,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="7,-1" stop="7,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="8,-1" stop="8,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="9,-1" stop="9,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="10,-1" stop="10,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="11,-1" stop="11,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="12,-1" stop="12,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="13,-1" stop="13,-1"/>
</blockTableStyle>
<blockTableStyle id="Table6">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="4,0" stop="4,0"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="5,0" stop="5,0"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="6,0" stop="6,0"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="7,0" stop="7,0"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="8,0" stop="8,0"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="9,0" stop="9,0"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="10,0" stop="10,0"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="11,0" stop="11,0"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="12,0" stop="12,0"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="13,0" stop="13,0"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="P1" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P2" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P3" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P4" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P5" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P6" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Standard" fontName="Helvetica"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Helvetica"/>
<paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_1" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="Table Contents" fontName="Helvetica"/>
<paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER"/>
<paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_default_Right_9_Bold" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<images/>
</stylesheet>
<story>
<para style="P1">Yearly Salary Details </para>
<para style="P5">From [[ formatLang(data['form']['start_date'], date=True) ]] To [[ formatLang(data['form']['end_date'], date=True) ]]</para>
<section>
<para style="terp_default_1">[[ repeatIn(get_periods(data['form']),'m') ]]</para>
<blockTable colWidths="71.0,31.0,31.0,31.0,31.0,31.0,31.0,31.0,31.0,31.0,31.0,31.0,31.0,35.0" style="Table1">
<tr>
<td>
<para style="terp_tblheader_Details">Name</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">[[ m[0] != 'None' and m[0] or '' ]]</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">[[ m[1] != 'None' and m[1] or '' ]]</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">[[ m[2] != 'None' and m[2] or '' ]]</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">[[ m[3] != 'None' and m[3] or '' ]]</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">[[ m[4] != 'None' and m[4] or '' ]]</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">[[ m[5] != 'None' and m[5] or '' ]]</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">[[ m[6] != 'None' and m[6] or '' ]]</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">[[ m[7] != 'None' and m[7] or '' ]]</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">[[ m[8] != 'None' and m[8] or '' ]]</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">[[ m[9] != 'None' and m[9] or '' ]]</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">[[ m[10] != 'None' and m[10] or '' ]]</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">[[ m[11] != 'None' and m[11] or '' ]]</para>
</td>
<td>
<para style="terp_tblheader_Details_Right">Total</para>
</td>
</tr>
</blockTable>
<section>
<para style="terp_default_1">[[ repeatIn(get_employee(data['form']),'e') ]]</para>
<blockTable colWidths="71.0,31.0,31.0,31.0,31.0,31.0,31.0,31.0,31.0,31.0,31.0,31.0,31.0,35.0" style="Table2">
<tr>
<td>
<para style="terp_default_9">[[ e[0] ]]</para>
</td>
<td>
<para style="terp_default_Right_8">
<font face="Helvetica" size="9.0">[[ (e[1]!='' and formatLang(e[1])) or removeParentNode('font') ]] [[company.currency_id.symbol]]</font>
</para>
</td>
<td>
<para style="terp_default_Right_8">
<font face="Helvetica" size="9.0">[[ (e[2]!='' and formatLang(e[2])) or removeParentNode('font') ]] [[company.currency_id.symbol]]</font>
</para>
</td>
<td>
<para style="terp_default_Right_8">
<font face="Helvetica" size="9.0">[[ (e[3]!='' and formatLang(e[3])) or removeParentNode('font') ]] [[company.currency_id.symbol]]</font>
</para>
</td>
<td>
<para style="terp_default_Right_8">
<font face="Helvetica" size="9.0">[[ (e[4]!='' and formatLang(e[4])) or removeParentNode('font') ]] [[company.currency_id.symbol]]</font>
</para>
</td>
<td>
<para style="terp_default_Right_8">
<font face="Helvetica" size="9.0">[[ (e[5]!='' and formatLang(e[5])) or removeParentNode('font') ]] [[company.currency_id.symbol]]</font>
</para>
</td>
<td>
<para style="terp_default_Right_8">
<font face="Helvetica" size="9.0">[[ (e[6]!='' and formatLang(e[6])) or removeParentNode('font') ]] [[company.currency_id.symbol]]</font>
</para>
</td>
<td>
<para style="terp_default_Right_8">
<font face="Helvetica" size="9.0">[[ (e[7]!='' and formatLang(e[7])) or removeParentNode('font') ]] [[company.currency_id.symbol]]</font>
</para>
</td>
<td>
<para style="terp_default_Right_8">
<font face="Helvetica" size="9.0">[[ (e[8]!='' and formatLang(e[8])) or removeParentNode('font') ]] [[company.currency_id.symbol]]</font>
</para>
</td>
<td>
<para style="terp_default_Right_8">
<font face="Helvetica" size="9.0">[[ (e[9]!='' and formatLang(e[9])) or removeParentNode('font') ]] [[company.currency_id.symbol]]</font>
</para>
</td>
<td>
<para style="terp_default_Right_8">
<font face="Helvetica" size="9.0">[[ (e[10]!='' and formatLang(e[10])) or removeParentNode('font') ]] [[company.currency_id.symbol]]</font>
</para>
</td>
<td>
<para style="terp_default_Right_8">
<font face="Helvetica" size="9.0">[[ (e[11]!='' and formatLang(e[11])) or removeParentNode('font') ]] [[company.currency_id.symbol]]</font>
</para>
</td>
<td>
<para style="terp_default_Right_8">
<font face="Helvetica" size="9.0">[[ (e[12]!='' and formatLang(e[12])) or removeParentNode('font') ]] [[company.currency_id.symbol]]</font>
</para>
</td>
<td>
<para style="terp_default_Right_9_Bold">[[ formatLang(e[13]) ]] [[company.currency_id.symbol]]</para>
</td>
</tr>
</blockTable>
<para style="P2">
<font color="white"> </font>
</para>
</section>
<para style="P2">
<font color="white"> </font>
</para>
</section>
<section>
<para style="terp_default_1">[[ repeatIn(get_months_tol(),'t') ]]</para>
<blockTable colWidths="71.0,31.0,31.0,31.0,31.0,31.0,31.0,31.0,31.0,31.0,31.0,31.0,31.0,35.0" style="Table6">
<tr>
<td>
<para style="terp_tblheader_Details">Total</para>
</td>
<td>
<para style="terp_tblheader_General_Right">[[ formatLang(t[1]) or removeParentNode('para') ]] [[company.currency_id.symbol]]</para>
</td>
<td>
<para style="terp_tblheader_General_Right">[[ formatLang(t[2]) or removeParentNode('para')]] [[company.currency_id.symbol]]</para>
</td>
<td>
<para style="terp_tblheader_General_Right">[[ formatLang(t[3]) or removeParentNode('para')]] [[company.currency_id.symbol]]</para>
</td>
<td>
<para style="terp_tblheader_General_Right">[[ formatLang(t[4]) or removeParentNode('para')]] [[company.currency_id.symbol]]</para>
</td>
<td>
<para style="terp_tblheader_General_Right">[[ formatLang(t[5]) or removeParentNode('para')]] [[company.currency_id.symbol]]</para>
</td>
<td>
<para style="terp_tblheader_General_Right">[[ formatLang(t[6]) or removeParentNode('para')]] [[company.currency_id.symbol]]</para>
</td>
<td>
<para style="terp_tblheader_General_Right">[[ formatLang(t[7]) or removeParentNode('para')]] [[company.currency_id.symbol]]</para>
</td>
<td>
<para style="terp_tblheader_General_Right">[[ formatLang(t[8]) or removeParentNode('para')]] [[company.currency_id.symbol]]</para>
</td>
<td>
<para style="terp_tblheader_General_Right">[[ formatLang(t[9]) or removeParentNode('para')]] [[company.currency_id.symbol]]</para>
</td>
<td>
<para style="terp_tblheader_General_Right">[[ formatLang(t[10]) or removeParentNode('para')]] [[company.currency_id.symbol]]</para>
</td>
<td>
<para style="terp_tblheader_General_Right">[[ formatLang(t[11]) or removeParentNode('para')]] [[company.currency_id.symbol]]</para>
</td>
<td>
<para style="terp_tblheader_General_Right">[[ formatLang(t[12]) or removeParentNode('para')]] [[company.currency_id.symbol]]</para>
</td>
<td>
<para style="terp_tblheader_General_Right">[[ formatLang(get_total()) ]] [[company.currency_id.symbol]]</para>
</td>
</tr>
</blockTable>
<para style="P2">
<font color="white"> </font>
</para>
</section>
<para style="P6">
<font color="white"> </font>
</para>
</story>
</document>

View File

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
import salary_rule_bymonth
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,66 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
from osv import osv, fields
class salary_rule_bymonth(osv.osv_memory):
_name = 'salary.rule.month'
# _inherit = 'hr.employee'
_description = 'Print Monthly Salary Rule Report'
_columns = {
'start_date': fields.date('Starting Date', required=True),
'end_date': fields.date('Ending Date', required=True),
'employee_ids': fields.many2many('hr.employee', 'payroll_year_rel','payroll_year_id','emp_id', 'Employees',required=True),
# 'rule_id': fields.many2one('hr.salary.rule.category', 'Rule Category', required=True),
}
_defaults = {
'start_date': lambda *a: time.strftime('%Y-01-01'),
'end_date': 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', 'start_date', 'end_date', ], context=context)
res = res and res[0] or {}
datas['form'] = res
datas['ids'] = res.get('employee_ids',[])
return {
'type': 'ir.actions.report.xml',
'report_name': 'salary.rule.bymonth',
'datas': datas,
}
salary_rule_bymonth()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_salary_rule_month" model="ir.ui.view">
<field name="name">Salary rule monthly</field>
<field name="model">salary.rule.month</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Print Salary Rule Monthly" version="7.0">
<header>
<button name="print_report" string="Print" type="object" class="oe_highlight"/>
or
<button string="Cancel" class="oe_link" special="cancel" />
</header>
<group>
<field name="start_date"/>
<field name="end_date"/>
<field name="employee_ids" nolabel="1" colspan="4"/>
</group>
</form>
</field>
</record>
<record id="action_salary_rule_month" model="ir.actions.act_window">
<field name="name">Salary rule monthly</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">salary.rule.month</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<record model="ir.values" id="hr_attendance_week_values">
<field name="model_id" ref="hr_payroll.model_hr_salary_rule_category" />
<field name="name">Salary rule monthly</field>
<field name="key2">client_print_multi</field>
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_salary_rule_month'))" />
<field name="key">action</field>
<field name="model">salary.rule.month</field>
</record>
<menuitem
name="Report"
parent="hr.menu_hr_root"
id="menu_monthly_salary_rule_report" sequence="50"
/>
<menuitem
name="Monthly salary rule report"
parent="menu_monthly_salary_rule_report"
action="action_salary_rule_month"
id="menu_monthly_salary_rule"
/>
</data>
</openerp>