[IMP]:hr_expense,hr_recruitment:Improved SQL reports.
bzr revid: apa@tinyerp.com-20100412091710-uz14ar0ew9yyqfsv
This commit is contained in:
@@ -35,8 +35,11 @@ class hr_expense_report(osv.osv):
|
||||
('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
|
||||
('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True),
|
||||
'product_id':fields.many2one('product.product', 'Product', readonly=True),
|
||||
'journal_id': fields.many2one('account.journal', 'Force Journal', readonly=True),
|
||||
'product_qty':fields.float('Qty', readonly=True),
|
||||
'employee_id': fields.many2one('hr.employee', "Employee's Name", readonly=True),
|
||||
'date_confirm': fields.date('Confirmation Date', readonly=True),
|
||||
'date_valid': fields.date('Validation Date', readonly=True),
|
||||
'invoice_id': fields.many2one('account.invoice', 'Invoice',readonly=True),
|
||||
'department_id':fields.many2one('hr.department','Department',readonly=True),
|
||||
'company_id':fields.many2one('res.company', 'Company', readonly=True),
|
||||
@@ -62,6 +65,9 @@ class hr_expense_report(osv.osv):
|
||||
min(l.id) as id,
|
||||
s.date as date,
|
||||
s.employee_id,
|
||||
s.journal_id,
|
||||
to_date(to_char(s.date_confirm, 'dd-MM-YYYY'),'dd-MM-YYYY') as date_confirm,
|
||||
to_date(to_char(s.date_valid, 'dd-MM-YYYY'),'dd-MM-YYYY') as date_valid,
|
||||
s.invoice_id,
|
||||
s.department_id,
|
||||
to_char(s.date, 'YYYY') as year,
|
||||
@@ -80,10 +86,18 @@ class hr_expense_report(osv.osv):
|
||||
hr_expense_expense s on (s.id=l.expense_id)
|
||||
left join product_uom u on (u.id=l.uom_id)
|
||||
group by
|
||||
s.date, l.product_id,s.invoice_id,
|
||||
s.date,
|
||||
to_date(to_char(s.date_confirm, 'dd-MM-YYYY'),'dd-MM-YYYY'),
|
||||
to_date(to_char(s.date_valid, 'dd-MM-YYYY'),'dd-MM-YYYY'),
|
||||
l.product_id,
|
||||
s.invoice_id,
|
||||
s.department_id,
|
||||
l.uom_id, s.user_id, s.state,
|
||||
s.company_id,s.employee_id
|
||||
l.uom_id,
|
||||
s.user_id,
|
||||
s.state,
|
||||
s.journal_id,
|
||||
s.company_id,
|
||||
s.employee_id
|
||||
)
|
||||
""")
|
||||
hr_expense_report()
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
<field name="invoice_id" invisible="1"/>
|
||||
<field name="department_id" invisible="1"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
<field name="journal_id" invisible="1"/>
|
||||
<field name="product_id"/>
|
||||
<field name="product_qty"/>
|
||||
<field name="nbr" sum="# of Lines"/>
|
||||
@@ -53,9 +54,6 @@
|
||||
domain="[('month','=',time.strftime('%%m'))]"
|
||||
help="Expenses of this month"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-hr"
|
||||
string="Draft"
|
||||
domain="[('state','=','draft')]"/>
|
||||
<filter icon="terp-hr"
|
||||
string="Expenses"
|
||||
default="1"
|
||||
@@ -69,16 +67,41 @@
|
||||
</field>
|
||||
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="1" string="Extended options..." colspan="10" col="12">
|
||||
<filter icon="terp-hr"
|
||||
string="Draft"
|
||||
domain="[('state','=','draft')]"/>
|
||||
<filter icon="terp-hr"
|
||||
string="Waiting confirmation"
|
||||
domain="[('state','=','confirm')]"/>
|
||||
<filter icon="terp-hr"
|
||||
string="Accepted"
|
||||
domain="[('state','=','accepted')]"/>
|
||||
<filter icon="terp-hr"
|
||||
string="Invoiced"
|
||||
domain="[('state','=','invoiced')]"/>
|
||||
<filter icon="terp-hr"
|
||||
string="Reimbursed"
|
||||
domain="[('state','=','paid')]"/>
|
||||
<filter icon="terp-hr"
|
||||
string="Cancelled"
|
||||
domain="[('state','=','cancelled')]"/>
|
||||
<newline/>
|
||||
<field name="date_confirm"/>
|
||||
<field name="date_valid"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="1" string="Group By..." colspan="10" col="12">
|
||||
<filter string="Company" icon="terp-hr" context="{'group_by':'company_id'}"/>
|
||||
<filter string="User" icon="terp-hr" context="{'group_by':'user_id'}" default="1"/>
|
||||
<filter string="Employee" icon="terp-hr" context="{'group_by':'employee_id'}"/>
|
||||
<filter string="Department" icon="terp-hr" context="{'group_by':'department_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Department" icon="terp-hr" context="{'group_by':'department_id'}"/>
|
||||
<filter string="Product" icon="terp-hr" context="{'group_by':'product_id'}"/>
|
||||
<filter string="State" icon="terp-hr" context="{'group_by':'state'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Force Journal" icon="terp-hr" context="{'group_by':'journal_id'}"/>
|
||||
<filter string="Month" icon="terp-hr" context="{'group_by':'date'}"/>
|
||||
<filter string="Year" icon="terp-hr" context="{'group_by':'year'}"/>
|
||||
</group>
|
||||
|
||||
@@ -46,8 +46,8 @@ class hr_recruitment_report(osv.osv):
|
||||
create or replace view hr_recruitment_report as (
|
||||
select
|
||||
min(s.id) as id,
|
||||
s.date as date,
|
||||
s.date_closed,
|
||||
date_trunc('day',s.date) as date,
|
||||
date_trunc('day',s.date_closed) as date_closed,
|
||||
to_char(s.date, 'YYYY') as name,
|
||||
to_char(s.date, 'MM') as month,
|
||||
s.state,
|
||||
@@ -62,13 +62,14 @@ class hr_recruitment_report(osv.osv):
|
||||
from hr_applicant s
|
||||
group by
|
||||
s.date,
|
||||
date_trunc('day',s.date),
|
||||
date_trunc('day',s.date_closed),
|
||||
s.state,
|
||||
s.company_id,
|
||||
s.user_id,
|
||||
s.stage_id,
|
||||
s.type_id,
|
||||
s.priority,
|
||||
s.date_closed,
|
||||
s.job_id,
|
||||
s.department_id
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user