From dd0063b51f9e7531f996cc0509f27c3fdc74b195 Mon Sep 17 00:00:00 2001 From: apa-tiny Date: Thu, 18 Mar 2010 15:30:28 +0530 Subject: [PATCH] [IMP]:improved hr_holidays report. bzr revid: apa@tinyerp.com-20100318100028-m8rbrahaizuwbi6y --- addons/hr_holidays/__terp__.py | 3 + addons/hr_holidays/hr_holidays_report.xml | 71 ----------------- addons/hr_holidays/report/__init__.py | 5 +- .../hr_holidays/report/available_holidays.py | 32 ++++++-- .../report/available_holidays_view.xml | 77 +++++++++++++++++++ .../hr_holidays/report/hr_holidays_report.py | 1 + .../report/hr_holidays_report_view.xml | 2 +- 7 files changed, 111 insertions(+), 80 deletions(-) create mode 100644 addons/hr_holidays/report/available_holidays_view.xml diff --git a/addons/hr_holidays/__terp__.py b/addons/hr_holidays/__terp__.py index 26dc78675cc..4f7c736425c 100644 --- a/addons/hr_holidays/__terp__.py +++ b/addons/hr_holidays/__terp__.py @@ -55,6 +55,9 @@ 'hr_view.xml', 'hr_holidays_wizard.xml', 'hr_holidays_report.xml', + 'report/hr_holidays_report_view.xml', + 'report/available_holidays_view.xml' + #'process/hr_holidays_process.xml' ], 'demo_xml': [], diff --git a/addons/hr_holidays/hr_holidays_report.xml b/addons/hr_holidays/hr_holidays_report.xml index 66669bd2f51..23d1e1a75bf 100644 --- a/addons/hr_holidays/hr_holidays_report.xml +++ b/addons/hr_holidays/hr_holidays_report.xml @@ -9,77 +9,6 @@ auto="False" menu="False"/> - - - - - - - hr.holidays.report.tree - hr.holidays.report - tree - - - - - - - - - - - hr.holidays.report.form - hr.holidays.report - form - - - - - - - - - - hr.holiday.report.graph - hr.holidays.report - graph - - - - - - - - - - - Available Holidays - hr.holidays.report - form - tree,graph - - - - - - - tree - - - - - - - - graph - - - - - - - - diff --git a/addons/hr_holidays/report/__init__.py b/addons/hr_holidays/report/__init__.py index 00783721fe3..a617b4b6d8a 100644 --- a/addons/hr_holidays/report/__init__.py +++ b/addons/hr_holidays/report/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (). # @@ -15,11 +15,12 @@ # 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 . +# along with this program. If not, see . # ############################################################################## import holidays_summary_report import available_holidays +import hr_holidays_report # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/hr_holidays/report/available_holidays.py b/addons/hr_holidays/report/available_holidays.py index 259aea0dec9..2b9441ccddb 100644 --- a/addons/hr_holidays/report/available_holidays.py +++ b/addons/hr_holidays/report/available_holidays.py @@ -1,20 +1,40 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# 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 . +# +############################################################################## from osv import fields,osv import tools -class hr_holidays_report(osv.osv): - _name = "hr.holidays.report" +class available_holidays_report(osv.osv): + _name = "available.holidays.report" _auto = False _columns = { 'employee_id': fields.many2one ('hr.employee', 'Employee', readonly=True), 'holiday_status_id': fields.many2one('hr.holidays.status', 'Leave Type', readonly=True), # 'max_leave': fields.float('Allocated Leaves', readonly=True), # 'taken_leaves': fields.float('Taken Leaves', readonly=True), - 'remaining_leave': fields.float('Remaining Leaves',readonly=True), + 'remaining_leave': fields.float('Remaining Leaves',readonly=True), } def init(self, cr): - tools.drop_view_if_exists(cr, 'hr_holidays_report') + tools.drop_view_if_exists(cr, 'available_holidays_report') cr.execute(""" - create or replace view hr_holidays_report as ( + create or replace view available_holidays_report as ( select min(h.id) as id, h.employee_id as employee_id, @@ -28,6 +48,6 @@ class hr_holidays_report(osv.osv): and s.active <> 'f' group by h.holiday_status_id, h.employee_id )""") -hr_holidays_report() +available_holidays_report() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/hr_holidays/report/available_holidays_view.xml b/addons/hr_holidays/report/available_holidays_view.xml new file mode 100644 index 00000000000..bfd009361ee --- /dev/null +++ b/addons/hr_holidays/report/available_holidays_view.xml @@ -0,0 +1,77 @@ + + + + + + + + available.holidays.report.tree + available.holidays.report + tree + + + + + + + + + + + available.holidays.report.form + available.holidays.report + form + + + + + + + + + + available.holidays.report.graph + available.holidays.report + graph + + + + + + + + + + + + + Available Holidays + available.holidays.report + form + tree,graph + + + + + + + tree + + + + + + + + graph + + + + + + + + + + + diff --git a/addons/hr_holidays/report/hr_holidays_report.py b/addons/hr_holidays/report/hr_holidays_report.py index 59a0a361eeb..f9b41b638f1 100644 --- a/addons/hr_holidays/report/hr_holidays_report.py +++ b/addons/hr_holidays/report/hr_holidays_report.py @@ -63,6 +63,7 @@ class hr_holidays_report(osv.osv): s.state from hr_holidays s + where type='remove' group by s.create_date,s.state,s.date_from,s.date_to, s.number_of_days_temp,s.employee_id,s.user_id diff --git a/addons/hr_holidays/report/hr_holidays_report_view.xml b/addons/hr_holidays/report/hr_holidays_report_view.xml index 6a8d1461799..1d756986ded 100644 --- a/addons/hr_holidays/report/hr_holidays_report_view.xml +++ b/addons/hr_holidays/report/hr_holidays_report_view.xml @@ -81,7 +81,7 @@ - +