[IMP]:hr_recruitment:Improved SQL view report.(Recruitment)

bzr revid: apa@tinyerp.com-20100421072500-a3rfxybzrwuvdabb
This commit is contained in:
apa-tiny 2010-04-21 12:55:00 +05:30
parent da1406263d
commit e5d0ce4fcc
2 changed files with 52 additions and 39 deletions

View File

@ -34,8 +34,9 @@ class hr_recruitment_report(osv.osv):
'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),
'date': fields.date('Date', readonly=True),
'date_closed': fields.datetime('Closed', readonly=True),
'date_closed': fields.date('Closed', readonly=True),
'job_id': fields.many2one('hr.job', 'Applied Job',readonly=True),
'stage_id': fields.many2one ('crm.case.stage', 'Stage', domain="[('section_id','=',section_id),('object_id.model', '=', 'hr.applicant')]",readonly=True),
'type_id': fields.many2one('crm.case.resource.type', 'Degree', domain="[('section_id','=',section_id),('object_id.model', '=', 'hr.applicant')]"),
@ -57,6 +58,7 @@ class hr_recruitment_report(osv.osv):
date_trunc('day',s.date_closed) as date_closed,
to_char(s.create_date, 'YYYY') as year,
to_char(s.create_date, 'MM') as month,
to_char(s.create_date, 'YYYY-MM-DD') as day,
s.state,
s.company_id,
s.user_id,
@ -73,6 +75,7 @@ class hr_recruitment_report(osv.osv):
group by
to_char(s.create_date, 'YYYY'),
to_char(s.create_date, 'MM'),
to_char(s.create_date, 'YYYY-MM-DD') ,
date_trunc('day',s.create_date),
date_trunc('day',s.date_closed),
s.state,

View File

@ -16,6 +16,7 @@
<field name="company_id" groups="base.group_multi_company"/>
<field name="state" invisible="1"/>
<field name="year" invisible="1"/>
<field name="day" invisible="1"/>
<field name="month" invisible="1"/>
<field name="nbr" sum="# Cases"/>
<field name="salary_prop" sum="Salary Proposed" />
@ -44,49 +45,57 @@
<field name="arch" type="xml">
<search string="Recruitments">
<group>
<filter icon="terp-hr"
string="This Year"
domain="[('year','=',time.strftime('%%Y'))]"
help="Recruitments of the year"/>
<filter icon="terp-hr"
string="This Month"
domain="[('month','=',time.strftime('%%m'))]"
help="Recruitments of this month"/>
<filter icon="terp-hr"
string="Current"
help="Draft and in progress recruitments"
domain="[('state','in',('open','draft'))]"
name="inprogress"
/>
<filter icon="terp-hr"
string="Pending"
domain="[('state','=','pending')]"/>
<field name="department_id" widget="selection">
<filter icon="terp-sale"
string="My Recruitments "
help="My Department Recruitments"
domain="[('user_id','=',uid)]"/>
<filter icon="terp-sale"
string="Recruitments non assigned to departments"
help="Recruitments non assigned to departments"
domain="[('user_id','=',False)]"/>
<filter icon="terp-hr" string="This Year"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
help="Tasks performed in this year"/>
<filter icon="terp-hr" string="This Month"
name="month"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"
help="Tasks performed in this month"/>
<filter icon="gtk-media-rewind"
string=" 7 Days "
separator="1"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
help="Tasks during last 7 days"/>
<separator orientation="vertical"/>
<filter string="Draft"
icon="terp-hr"
domain="[('state','=','draft')]"
help = "Draft tasks"/>
<filter string="Current"
icon="terp-hr"
domain="[('state', '=' ,'open')]"
help = "In progress tasks"/>
<filter string="Pending"
icon="terp-hr"
domain="[('state','=','pending')]"
help = "Pending tasks"/>
<separator orientation="vertical"/>
<field name="department_id" widget="selection">
<filter icon="terp-hr"
string="My Recruitments "
help="My Department Recruitments"
domain="[('user_id','=',uid)]"/>
<filter icon="terp-hr"
string="Recruitments non assigned to departments"
help="Recruitments non assigned to departments"
domain="[('user_id','=',False)]"/>
</field>
<separator orientation="vertical"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<field name="user_id" widget="selection">
<filter icon="terp-sale"
<filter icon="terp-hr"
string="My Recruitments"
help="My Recruitments"
domain="[('user_id','=',uid)]"/>
<filter icon="terp-sale"
<filter icon="terp-hr"
string="Recruitments non assigned"
help="Recruitments non assigned"
domain="[('user_id','=',False)]"/>
</field>
</group>
<newline/>
<group expand="1" string="Extended options..." colspan="10" col="12">
<group expand="0" string="Extended options..." colspan="10" col="12">
<filter icon="terp-hr"
string="Hired"
name="done"
@ -94,17 +103,18 @@
<filter icon="terp-hr"
string="Refused"
domain="[('state','=','cancel')]"/>
<separator orientation="vertical"/>
<field name="priority"/>
<newline/>
<field name="stage_id" widget="selection"/>
<field name="job_id" widget="selection"/>
<newline/>
<field name="type_id" widget="selection"/>
<field name="date"/>
<field name="stage_id" widget="selection"/>
<field name="job_id" widget="selection"/>
<field name="type_id" widget="selection"/>
<field name="date_closed"/>
</group>
<newline/>
<group string="Group By ..." colspan="10" col="12">
<filter string="User" icon="terp-hr" domain="[]" context="{'group_by':'user_id'}"/>
<group expand="1" string="Group By ..." colspan="10" col="12">
<filter string="User" name='User' icon="terp-hr" domain="[]" context="{'group_by':'user_id'}"/>
<filter string="Company" icon="terp-hr" domain="[]" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Stage" name="Stage" icon="terp-hr" domain="[]" context="{'group_by':'stage_id'}" />
<separator orientation="vertical"/>
@ -113,7 +123,7 @@
<filter string="Department" icon="terp-hr" domain="[]" context="{'group_by':'department_id'}"/>
<filter string="Degree" icon="terp-hr" domain="[]" context="{'group_by':'type_id'}"/>
<separator orientation="vertical"/>
<filter string="Day" name = "day" icon="terp-hr" domain="[]" context="{'group_by':'date'}"/>
<filter string="Day" name = "day" icon="terp-hr" domain="[]" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-hr" domain="[]" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-hr" domain="[]" context="{'group_by':'year'}"/>
</group>
@ -126,7 +136,7 @@
<field name="res_model">hr.recruitment.report</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="context">{'search_default_inprogress': 1, 'search_default_user_id': uid }</field>
<field name="context">{'search_default_month':1,'search_default_User':1,'group_by_no_leaf':1,'group_by':[]}</field>
<field name="search_view_id" ref="view_hr_recruitment_report_search"/>
</record>
<menuitem id="hr.menu_hr_reporting" name="Reporting" parent="hr.menu_hr_root"/>