[ADD]l10n_in_hr_payroll:added postgres report for payslip and palyslip lines
bzr revid: kbh@tinyerp.com-20120824093657-dlw1d0bh39cg7h79
This commit is contained in:
parent
62070621f6
commit
d3eac6d18a
|
@ -53,6 +53,7 @@ Indian Payroll Salary Rules.
|
|||
'wizard/hr_salary_employee_bymonth_view.xml',
|
||||
'wizard/hr_yearly_salary_detail_view.xml',
|
||||
'report/payment_advice_report_view.xml',
|
||||
'report/payslip_report_view.xml',
|
||||
|
||||
],
|
||||
'test': [
|
||||
|
|
|
@ -27,5 +27,6 @@ import report_payroll_advice
|
|||
import report_hr_salary_employee_bymonth
|
||||
import payment_advice_report
|
||||
import report_hr_yearly_salary_detail
|
||||
import payslip_report
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2012-Today OpenERP SA (<http://www.openerp.com>).
|
||||
#
|
||||
# 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 tools
|
||||
from osv import fields, osv
|
||||
|
||||
class payslip_report(osv.osv):
|
||||
_name = "payslip.report"
|
||||
_description = "Payslip Analysis"
|
||||
_auto = False
|
||||
_columns = {
|
||||
'name':fields.char('Name', size=32, readonly=True),
|
||||
'date_from': fields.date('Date From', readonly=True,),
|
||||
'date_to': fields.date('Date To', readonly=True,),
|
||||
'year': fields.char('Year', size=4, readonly=True),
|
||||
'month': fields.selection([('01', 'January'), ('02', 'February'), ('03', 'March'), ('04', 'April'),
|
||||
('05', 'May'), ('06', 'June'), ('07', 'July'), ('08', 'August'), ('09', 'September'),
|
||||
('10', 'October'), ('11', 'November'), ('12', 'December')], 'Month', readonly=True),
|
||||
'day': fields.char('Day', size=128, readonly=True),
|
||||
'state': fields.selection([
|
||||
('draft', 'Draft'),
|
||||
('done', 'Done'),
|
||||
('cancel', 'Rejected'),
|
||||
], 'State', readonly=True),
|
||||
'employee_id': fields.many2one('hr.employee', 'Employee', readonly=True),
|
||||
'nbr': fields.integer('# Payslip lines', readonly=True),
|
||||
'number': fields.char('Number', size=16, readonly=True),
|
||||
'struct_id': fields.many2one('hr.payroll.structure', 'Structure', readonly=True),
|
||||
'company_id':fields.many2one('res.company', 'Company', readonly=True),
|
||||
'paid': fields.boolean('Made Payment Order ? ', readonly=True),
|
||||
'total': fields.float('Total', readonly=True),
|
||||
'category_id':fields.many2one('hr.salary.rule.category', 'Category', readonly=True),
|
||||
}
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'payslip_report')
|
||||
cr.execute("""
|
||||
create or replace view payslip_report as (
|
||||
select
|
||||
min(l.id) as id,
|
||||
l.name,
|
||||
p.struct_id,
|
||||
p.state,
|
||||
p.date_from,
|
||||
p.date_to,
|
||||
p.number,
|
||||
p.company_id,
|
||||
p.paid,
|
||||
l.category_id,
|
||||
l.employee_id,
|
||||
sum(l.total) as total,
|
||||
to_char(p.date_from, 'YYYY') as year,
|
||||
to_char(p.date_from, 'MM') as month,
|
||||
to_char(p.date_from, 'YYYY-MM-DD') as day,
|
||||
to_char(p.date_to, 'YYYY') as to_year,
|
||||
to_char(p.date_to, 'MM') as to_month,
|
||||
to_char(p.date_to, 'YYYY-MM-DD') as to_day,
|
||||
1 AS nbr
|
||||
from
|
||||
hr_payslip as p
|
||||
left join hr_payslip_line as l on (p.id=l.slip_id)
|
||||
where
|
||||
l.employee_id IS NOT NULL
|
||||
group by
|
||||
p.number,l.name,p.date_from,p.date_to,p.state,p.company_id,p.paid,
|
||||
l.employee_id,p.struct_id,l.category_id
|
||||
)
|
||||
""")
|
||||
payslip_report()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,87 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_payslip_tree" model="ir.ui.view">
|
||||
<field name="name">payslip.report.tree</field>
|
||||
<field name="model">payslip.report</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree colors="blue:state == 'draft';black:state == 'done';gray:state == 'cancel' " string="Payslip Analysis">
|
||||
<field name="nbr" sum="# Payslip Lines"/>
|
||||
<field name="name"/>
|
||||
<field name="employee_id" invisible="1"/>
|
||||
<field name="date_to" invisible="1"/>
|
||||
<field name="date_from" invisible="1"/>
|
||||
<field name="state" invisible="1"/>
|
||||
<field name="number" invisible="1"/>
|
||||
<field name="struct_id" invisible="1"/>
|
||||
<field name="year" invisible="1"/>
|
||||
<field name="day" invisible="1"/>
|
||||
<field name="month" invisible="1"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
<field name="paid" invisible="1"/>
|
||||
<field name="total" />
|
||||
<field name="category_id" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_payslip_search" model="ir.ui.view">
|
||||
<field name="name">payslip.report.search</field>
|
||||
<field name="model">payslip.report</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Payslip Analysis">
|
||||
<group>
|
||||
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Payslips which are in draft state"/>
|
||||
<filter icon="terp-check" string="Done" name="done" domain="[('state','=','done')]" help="Payslips which are in done state"/>
|
||||
<filter icon="terp-check" string="Rejected" name="cancel" domain="[('state','=','cancel')]" help="Payslips which are in cancel state"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-camera_test" string="Paid" domain="[('paid','=',True)]" help="Payslips which are paid"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="date_from"/>
|
||||
<field name="date_to"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="number"/>
|
||||
<field name="name"/>
|
||||
<field name="employee_id"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="1" string="Extended Filters...">
|
||||
<separator orientation="vertical"/>
|
||||
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="1" string="Group By...">
|
||||
<filter string="Day" icon="terp-go-today" context="{'group_by':'day'}" help="Day of Payslip"/>
|
||||
<filter string="Month" name="order_month" icon="terp-go-month" context="{'group_by':'month'}" help="Month of Payslip"/>
|
||||
<filter string="Year" icon="terp-go-year" context="{'group_by':'year'}" help="Year of Payslip"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Employee" name="employee" icon="terp-personal" context="{'group_by':'employee_id'}" />
|
||||
<filter string="Structure" context="{'group_by':'struct_id'}" />
|
||||
<filter string="Category" name="category" context="{'group_by':'category_id'}" />
|
||||
<filter string="Line Name" context="{'group_by':'name'}" />
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Status" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Company" icon="terp-go-home" groups="base.group_multi_company" context="{'group_by':'company_id'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_payslip_report_all" model="ir.actions.act_window">
|
||||
<field name="name">Payslip Analysis</field>
|
||||
<field name="res_model">payslip.report</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="view_id" ref="view_payslip_tree"/>
|
||||
<field name="context">{'search_default_order_month':1,'search_default_employee':1,'search_default_category':1,'group_by_no_leaf':uid,'group_by':[]}</field>
|
||||
<field name="help">This report performs analysis on Payslip</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="action_payslip_report_all" id="menu_reporting_payslip" parent="hr.menu_hr_reporting" sequence="5" groups="base.group_hr_manager"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
Loading…
Reference in New Issue