[ADD] board_hr : Leaves by Type graph view added in hr dash board
bzr revid: vir@tinyerp.com-20100406060622-2x28znygyzlgtgaq
This commit is contained in:
@@ -33,15 +33,24 @@
|
||||
<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="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="action_hr_holidays_by_type_all" model="ir.actions.act_window">
|
||||
<field name="name">Leaves by Type</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">hr.holidays.by.type</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">graph,tree</field>
|
||||
<field name="view_id" ref="hr_holidays.view_hr_holidays_by_type_graph"/>
|
||||
</record>
|
||||
<record id="board_hr_form" model="ir.ui.view">
|
||||
<field name="name">board.hr.form</field>
|
||||
<field name="model">board.board</field>
|
||||
@@ -50,8 +59,9 @@
|
||||
<form string="My Board">
|
||||
<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" />
|
||||
<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" />
|
||||
<action colspan="4" height="220" name="%(action_hr_holidays_by_type_all)d" string="Leaves by Type" />
|
||||
</child1>
|
||||
<child2>
|
||||
<action colspan="4" height="220" name="%(action_view_holiday_status_board)d" string="My Leaves"/>
|
||||
|
||||
@@ -71,3 +71,29 @@ class hr_holidays_report(osv.osv):
|
||||
""")
|
||||
hr_holidays_report()
|
||||
|
||||
class hr_holidays_by_type(osv.osv):
|
||||
_name = "hr.holidays.by.type"
|
||||
_description = "Total holidays by type"
|
||||
_auto = False
|
||||
_columns = {
|
||||
'name': fields.char('Leave Type',size=64),
|
||||
'no_of_leaves' : fields.integer('Total leaves'),
|
||||
|
||||
}
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'hr_holidays_by_type')
|
||||
cr.execute("""
|
||||
create or replace view hr_holidays_by_type as (
|
||||
select
|
||||
min(hhl.id) as id,
|
||||
hhs.name as name,
|
||||
sum(hhl.number_of_days) * -1 as no_of_leaves
|
||||
from
|
||||
hr_holidays as hhl,hr_holidays_status as hhs
|
||||
where
|
||||
hhs.id = hhl.holiday_status_id and number_of_days < 0
|
||||
group by
|
||||
hhs.name,hhl.holiday_status_id
|
||||
)
|
||||
""")
|
||||
hr_holidays_by_type()
|
||||
|
||||
@@ -90,5 +90,28 @@
|
||||
|
||||
<menuitem action="action_hr_holidays_report_all" id="menu_hr_holidays_report_all" parent="menu_hr_reporting_holidays" sequence="0"/>
|
||||
|
||||
<record id="view_hr_holidays_by_type_tree" model="ir.ui.view">
|
||||
<field name="name">hr.holidays.by.type.tree</field>
|
||||
<field name="model">hr.holidays.by.type</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Leaves by Type">
|
||||
<field name="name"/>
|
||||
<field name="no_of_leaves"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_hr_holidays_by_type_graph" model="ir.ui.view">
|
||||
<field name="name">hr.holidays.by.type.graph</field>
|
||||
<field name="model">hr.holidays.by.type</field>
|
||||
<field name="type">graph</field>
|
||||
<field name="arch" type="xml">
|
||||
<graph string="Leaves by Type" type="bar">
|
||||
<field name="name"/>
|
||||
<field name="no_of_leaves" operator="+"/>
|
||||
</graph>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
Reference in New Issue
Block a user