[MERGE] l10n_in_hr_payroll: Advice analyis report added

bzr revid: mra@tinyerp.com-20120718093921-2dvnf6pqa79jkrsq
This commit is contained in:
Mustufa Rangwala (OpenERP) 2012-07-18 15:09:21 +05:30
commit 897a82a91e
5 changed files with 182 additions and 7 deletions

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',
'report/payment_advice_report_view.xml',
],
'demo_xml': ['l10n_in_hr_payroll_demo.xml'],
'installable': True

View File

@ -150,8 +150,8 @@
<field name="arch" type="xml">
<search string="Search Payment advice">
<group>
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Advice"/>
<filter icon="terp-camera_test" string="Done" domain="[('state','=','confirm')]" help="Done Advice"/>
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Advices"/>
<filter icon="terp-camera_test" string="Confirm" domain="[('state','=','confirm')]" help="Confirm Advices"/>
<separator orientation="vertical"/>
<field name="date"/>
<field name="number"/>
@ -160,11 +160,11 @@
</group>
<newline/>
<group expand="0" string="Group By...">
<filter string="Bank" name="bank_id" icon="terp-folder-orange" context="{'group_by':'bank_id'}"/>
<separator orientation="vertical" />
<filter string="Companies" name="company_id" groups="base.group_multi_company" icon="terp-go-home" context="{'group_by':'company_id'}"/>
<filter string="Bank" name="bank_id" icon="terp-go-home" context="{'group_by':'bank_id'}"/>
<separator orientation="vertical"/>
<filter string="States" name="state" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
<filter string="Status" name="state" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
<separator orientation="vertical" />
<filter string="Company" name="company_id" groups="base.group_multi_company" icon="terp-go-home" context="{'group_by':'company_id'}"/>
</group>
</search>
</field>

View File

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

View File

@ -0,0 +1,85 @@
# -*- 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 payment_advice_report(osv.osv):
_name = "payment.advice.report"
_description = "Payment Advice Analysis"
_auto = False
_columns = {
'name':fields.char('Name', size=32, readonly=True),
'date': fields.date('Date', 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'),
('confirm', 'Confirmed'),
('cancel', 'Cancelled'),
], 'State', select=True, readonly=True),
'employee_id': fields.many2one('hr.employee', 'Employee', readonly=True),
'nbr': fields.integer('# Payment Lines', readonly=True),
'number':fields.char('Number', size=16, readonly=True),
'bysal': fields.float('By Salary', readonly=True),
'bank_id':fields.many2one('res.bank', 'Bank', readonly=True),
'company_id':fields.many2one('res.company', 'Company', readonly=True),
'cheque_nos':fields.char('Cheque Numbers', size=256, readonly=True),
'neft': fields.boolean('NEFT Transaction', readonly=True),
'ifsc_code': fields.char('IFSC Code', size=32, readonly=True),
'employee_bank_no': fields.char('Employee Bank Account', size=32, required=True),
}
def init(self, cr):
tools.drop_view_if_exists(cr, 'payment_advice_report')
cr.execute("""
create or replace view payment_advice_report as (
select
min(l.id) as id,
sum(l.bysal) as bysal,
p.name,
p.state,
p.date,
p.number,
p.company_id,
p.bank_id,
p.chaque_nos as cheque_nos,
p.neft,
l.employee_id,
l.ifsc_code,
l.name as employee_bank_no,
to_char(p.date, 'YYYY') as year,
to_char(p.date, 'MM') as month,
to_char(p.date, 'YYYY-MM-DD') as day,
1 as nbr
from
hr_payroll_advice as p
left join hr_payroll_advice_line as l on (p.id=l.advice_id)
group by
p.number,p.name,p.date,p.state,p.company_id,p.bank_id,p.chaque_nos,p.neft,
l.employee_id,l.advice_id,l.bysal,l.ifsc_code, l.name
)
""")
payment_advice_report()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_payment_advice_tree" model="ir.ui.view">
<field name="name">payment.advice.report.tree</field>
<field name="model">payment.advice.report</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree colors="blue:state == 'draft';black:state == 'confirm';gray:state == 'cancel' " string="Advices Analysis">
<field name="nbr" sum="# of Lines"/>
<field name="name" invisible="1"/>
<field name="employee_id" invisible="1"/>
<field name="date" invisible="1"/>
<field name="bank_id" invisible="1"/>
<field name="state" invisible="1"/>
<field name="number" invisible="1"/>
<field name="bysal" sum="Total Salary"/>
<field name="year" invisible="1"/>
<field name="day" invisible="1"/>
<field name="month" invisible="1"/>
<field name="company_id" invisible="1"/>
<field name="cheque_nos" invisible="1"/>
<field name="neft" invisible="1"/>
<field name="ifsc_code" invisible="1"/>
</tree>
</field>
</record>
<record id="view_payment_advice_search" model="ir.ui.view">
<field name="name">payment.advice.report.search</field>
<field name="model">payment.advice.report</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Advices Analysis">
<group>
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Payment Advices which are in draft state"/>
<filter icon="terp-check" string="Confirm" name="confirm" domain="[('state','=','confirm')]" help="Payment Advices which are in confirm state"/>
<separator orientation="vertical"/>
<filter icon="terp-camera_test" string="NEFT" domain="[('neft','=',True)]" help="Advices which are paid using NEFT transfer"/>
<separator orientation="vertical"/>
<field name="date"/>
<separator orientation="vertical"/>
<field name="number"/>
<field name="name"/>
<field name="employee_id"/>
<field name="cheque_nos"/>
</group>
<newline/>
<group expand="0" string="Extended Filters...">
<field name="ifsc_code"/>
<field name="bank_id" widget="selection"/>
<field name="employee_bank_no"/>
<separator orientation="vertical"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group>
<newline/>
<group expand="1" string="Group By...">
<filter string="Employee" icon="terp-personal" context="{'group_by':'employee_id'}" />
<filter string="Bank" icon="terp-go-home" context="{'group_by':'bank_id'}"/>
<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'}"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-go-today" context="{'group_by':'day'}" help="Day of Payment Advices"/>
<filter string="Month" name="order_month" icon="terp-go-month" context="{'group_by':'month'}" help="Month of Payment Advices"/>
<filter string="Year" icon="terp-go-year" context="{'group_by':'year'}" help="Year of Payment Advices"/>
</group>
</search>
</field>
</record>
<record id="action_payment_advice_report_all" model="ir.actions.act_window">
<field name="name">Advices Analysis</field>
<field name="res_model">payment.advice.report</field>
<field name="view_type">form</field>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_payment_advice_tree"/>
<field name="context">{'search_default_confirm':1,'group_by_no_leaf':1,'group_by':[]}</field>
<field name="help">This report performs analysis on Payment Advices</field>
</record>
<menuitem action="action_payment_advice_report_all" id="menu_reporting_payment_advice" parent="hr.menu_hr_reporting" sequence="5" groups="base.group_hr_manager"/>
</data>
</openerp>