board_hr : Timesheet by month, graph view added

bzr revid: vir@tinyerp.com-20100405133332-4kt3cb7myc8heq45
This commit is contained in:
Vir (Open ERP) 2010-04-05 19:03:32 +05:30
parent 65050c80fc
commit 040857a953
6 changed files with 123 additions and 3 deletions

View File

@ -33,7 +33,15 @@
<field name="view_mode">tree,form</field>
<field name="view_id" ref="hr_holidays.open_allocation_holidays"/>
</record>
<record id="action_timesheet_report_all" model="ir.actions.act_window">
<field name="name">Timesheets by Month</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">timesheet.report</field>
<field name="view_type">form</field>
<field name="view_mode">graph,tree</field>
<field name="domain">[('user_id','=',uid)]</field>
<field name="view_id" ref="hr_timesheet_sheet.view_timesheet_report_graph"/>
</record>
<record id="board_hr_form" model="ir.ui.view">
<field name="name">board.hr.form</field>
<field name="model">board.board</field>
@ -43,6 +51,7 @@
<hpaned>
<child1>
<action colspan="4" height="220" name="%(act_hr_current_timesheet_sheet_form)d" string="My current timesheet" width="510"/>
<action colspan="4" height="220" name="%(action_timesheet_report_all)d" string="Timesheets by Month" />
</child1>
<child2>
<action colspan="4" height="220" name="%(action_view_holiday_status_board)d" string="My Leaves"/>

View File

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

View File

@ -52,7 +52,8 @@ The validation can be configured in te company:
'security/hr_timesheet_data.xml',
'hr_timesheet_sheet_view.xml',
'hr_timesheet_workflow.xml',
'process/hr_timesheet_sheet_process.xml'
'process/hr_timesheet_sheet_process.xml',
'report/timesheet_report_view.xml',
],
'demo_xml': ['hr_timesheet_sheet_demo.xml'],
'installable': True,

View File

@ -0,0 +1,25 @@
# -*- 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 timesheet_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,53 @@
# -*- 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 tools
from osv import fields,osv
class timesheet_report(osv.osv):
_name = "timesheet.report"
_description = "Timesheet by month "
_auto = False
_columns = {
'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),
'no_of_timesheet': fields.integer('Total Timesheet',readonly=True),
}
def init(self, cr):
tools.drop_view_if_exists(cr, 'timesheet_report')
cr.execute("""
create or replace view timesheet_report as (
select
min(id) as id,
to_char(create_date, 'MM') as month,
user_id,
count(*) as no_of_timesheet
from
hr_timesheet_sheet_sheet
where
to_char(create_date,'YYYY') = to_char(current_date,'YYYY')
group by
to_char(create_date,'MM'),user_id
)
""")
timesheet_report()

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_timesheet_report_tree" model="ir.ui.view">
<field name="name">timesheet.report.tree</field>
<field name="model">timesheet.report</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="TimeSheet">
<field name="month" />
<field name="no_of_timesheet" />
</tree>
</field>
</record>
<record id="view_timesheet_report_graph" model="ir.ui.view">
<field name="name">timesheet.report.graph</field>
<field name="model">timesheet.report</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="TimeSheet" type="bar">
<field name="month" />
<field name="no_of_timesheet" operator="+"/>
</graph>
</field>
</record>
</data>
</openerp>