From d3eac6d18a37b34c3492fae4f2869c20fe64d23a Mon Sep 17 00:00:00 2001 From: "Khushboo Bhatt (Open ERP)" Date: Fri, 24 Aug 2012 15:06:57 +0530 Subject: [PATCH] [ADD]l10n_in_hr_payroll:added postgres report for payslip and palyslip lines bzr revid: kbh@tinyerp.com-20120824093657-dlw1d0bh39cg7h79 --- addons/l10n_in_hr_payroll/__openerp__.py | 1 + addons/l10n_in_hr_payroll/report/__init__.py | 1 + .../report/payslip_report.py | 88 +++++++++++++++++++ .../report/payslip_report_view.xml | 87 ++++++++++++++++++ 4 files changed, 177 insertions(+) create mode 100644 addons/l10n_in_hr_payroll/report/payslip_report.py create mode 100644 addons/l10n_in_hr_payroll/report/payslip_report_view.xml diff --git a/addons/l10n_in_hr_payroll/__openerp__.py b/addons/l10n_in_hr_payroll/__openerp__.py index 8fbf6f1a9de..6d891c7a08e 100644 --- a/addons/l10n_in_hr_payroll/__openerp__.py +++ b/addons/l10n_in_hr_payroll/__openerp__.py @@ -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': [ diff --git a/addons/l10n_in_hr_payroll/report/__init__.py b/addons/l10n_in_hr_payroll/report/__init__.py index 5c76aa37e1c..8a20170c384 100644 --- a/addons/l10n_in_hr_payroll/report/__init__.py +++ b/addons/l10n_in_hr_payroll/report/__init__.py @@ -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: diff --git a/addons/l10n_in_hr_payroll/report/payslip_report.py b/addons/l10n_in_hr_payroll/report/payslip_report.py new file mode 100644 index 00000000000..b688af4329b --- /dev/null +++ b/addons/l10n_in_hr_payroll/report/payslip_report.py @@ -0,0 +1,88 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2012-Today OpenERP SA (). +# +# 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 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: diff --git a/addons/l10n_in_hr_payroll/report/payslip_report_view.xml b/addons/l10n_in_hr_payroll/report/payslip_report_view.xml new file mode 100644 index 00000000000..a6fc870b76b --- /dev/null +++ b/addons/l10n_in_hr_payroll/report/payslip_report_view.xml @@ -0,0 +1,87 @@ + + + + + + payslip.report.tree + payslip.report + tree + + + + + + + + + + + + + + + + + + + + + + + payslip.report.search + payslip.report + search + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Payslip Analysis + payslip.report + form + tree + + {'search_default_order_month':1,'search_default_employee':1,'search_default_category':1,'group_by_no_leaf':uid,'group_by':[]} + This report performs analysis on Payslip + + + + + +