[IMP] crm_claim:-useability improvements in Reporting/Claim Analysis
bzr revid: mtr@mtr-20100921071753-cozn5vkd9u5c8wn4
This commit is contained in:
parent
cf165abb1b
commit
f78d6f2b50
|
@ -74,6 +74,8 @@ class crm_claim_report(osv.osv):
|
|||
'type_id': fields.many2one('crm.case.resource.type', 'Claim Type',\
|
||||
domain="[('section_id','=',section_id),\
|
||||
('object_id.model', '=', 'crm.claim')]"),
|
||||
'date_closed': fields.date('Closed', readonly=True),
|
||||
'delay_expected': fields.float('Overpassed Deadline',digits=(16,2),readonly=True, group_operator="avg"),
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
|
@ -87,9 +89,10 @@ class crm_claim_report(osv.osv):
|
|||
create or replace view crm_claim_report as (
|
||||
select
|
||||
min(c.id) as id,
|
||||
to_char(c.create_date, 'YYYY') as name,
|
||||
to_char(c.create_date, 'MM') as month,
|
||||
to_char(c.create_date, 'YYYY-MM-DD') as day,
|
||||
to_char(c.date, 'YYYY') as name,
|
||||
to_char(c.date, 'MM') as month,
|
||||
to_char(c.date, 'YYYY-MM-DD') as day,
|
||||
to_char(c.date_closed, 'YYYY-MM-DD') as date_closed,
|
||||
c.state,
|
||||
c.user_id,
|
||||
c.stage_id,
|
||||
|
@ -101,13 +104,14 @@ class crm_claim_report(osv.osv):
|
|||
c.priority as priority,
|
||||
c.type_id as type_id,
|
||||
date_trunc('day',c.create_date) as create_date,
|
||||
avg(extract('epoch' from (c.date_closed-c.create_date)))/(3600*24) as delay_close
|
||||
avg(extract('epoch' from (c.date_closed-c.create_date)))/(3600*24) as delay_close,
|
||||
extract('epoch' from (c.date_deadline - c.date_closed))/(3600*24) as delay_expected
|
||||
from
|
||||
crm_claim c
|
||||
group by to_char(c.create_date, 'YYYY'), to_char(c.create_date, 'MM'), \
|
||||
group by to_char(c.date, 'YYYY'), to_char(c.date, 'MM'),to_char(c.date, 'YYYY-MM-DD'),\
|
||||
c.state, c.user_id,c.section_id, c.stage_id,\
|
||||
c.categ_id,c.partner_id,c.company_id,c.create_date,to_char(c.create_date, 'YYYY-MM-DD')
|
||||
,c.priority,c.type_id
|
||||
c.categ_id,c.partner_id,c.company_id,c.create_date,
|
||||
c.priority,c.type_id,c.date_deadline,c.date_closed
|
||||
)""")
|
||||
|
||||
crm_claim_report()
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
<field name="day" invisible="1"/>
|
||||
<field name="nbr" string="#Claim" sum="#Claim"/>
|
||||
<field name="delay_close" avg="Avg Closing Delay"/>
|
||||
<field name="delay_expected"/>
|
||||
<field name="state" invisible="1"/>
|
||||
<field name="stage_id" invisible="1"/>
|
||||
<field name="categ_id" invisible="1"/>
|
||||
|
@ -42,6 +43,7 @@
|
|||
<field name="section_id" select="1"/>
|
||||
<field name="nbr" select="1"/>
|
||||
<field name="delay_close"/>
|
||||
<field name="delay_expected"/>
|
||||
<field name="amount_revenue"/>
|
||||
<field name="amount_costs"/>
|
||||
<field name="amount_revenue_prob"/>
|
||||
|
@ -75,14 +77,17 @@
|
|||
<field name="arch" type="xml">
|
||||
<search string="Search">
|
||||
<group col="16" colspan="8">
|
||||
<filter string="This Year" icon="terp-go-year"
|
||||
domain="[('create_date','<=', time.strftime('%%Y-%%m-%%d')), ('create_date','>',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"/>
|
||||
<filter string=" Year " icon="terp-go-year"
|
||||
domain="[('create_date','<=', time.strftime('%%Y-%%m-%%d')),('create_date','>=',time.strftime('%%Y-01-01'))]"
|
||||
help="Claims created in last 365 days"/>
|
||||
|
||||
<filter string="This Month" icon="terp-go-month" name="This Month"
|
||||
domain="[('create_date','<=', time.strftime('%%Y-%%m-%%d')), ('create_date','>',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"/>
|
||||
<filter string=" Month " icon="terp-go-month" name="This Month"
|
||||
domain="[('create_date','<=', time.strftime('%%Y-%%m-%%d')),('create_date','>=',time.strftime('%%Y-%%m-01'))]"
|
||||
help="Claims created in last 30 days"/>
|
||||
|
||||
<filter icon="terp-go-week" string="7 Days" separator="1"
|
||||
domain="[('create_date','<=', time.strftime('%%Y-%%m-%%d')), ('create_date','>',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"/>
|
||||
<filter icon="terp-go-week" string=" Month-1 " separator="1"
|
||||
domain="[('create_date','<=', (datetime.date (int(time.strftime('%%Y')), datetime.date.today().month, 1) - datetime.timedelta (days = 1)).strftime('%%Y-%%m-%%d')),('create_date','>',(datetime.date (int(time.strftime('%%Y')), datetime.date.today().month-1, 1)).strftime('%%Y-%%m-%%d'))]"
|
||||
help="Claims created in the previous month"/>
|
||||
|
||||
<separator orientation="vertical" />
|
||||
<filter icon="terp-document-new"
|
||||
|
@ -98,7 +103,6 @@
|
|||
<separator orientation="vertical" />
|
||||
<field name="section_id"
|
||||
default="context.get('section_id', False)"
|
||||
widget="selection"
|
||||
context="{'invisible_section': False}">
|
||||
|
||||
<filter icon="terp-personal+"
|
||||
|
@ -107,58 +111,58 @@
|
|||
help="My section" />
|
||||
|
||||
</field>
|
||||
<field name="company_id" widget="selection">
|
||||
<field name="company_id">
|
||||
<filter icon="terp-go-home"
|
||||
context="{'invisible_section': False}"
|
||||
domain="[('section_id.user_id.company_id','=',uid)]"
|
||||
help="My company"/>
|
||||
</field>
|
||||
|
||||
<field name="user_id" select="1" widget="selection">
|
||||
<field name="user_id" select="1">
|
||||
<filter icon="terp-personal+" string="My Case" help="My Case" domain="[('user_id','=',uid)]" />
|
||||
</field>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By...">
|
||||
<filter string="User" name="User" icon="terp-personal"
|
||||
<filter string="Salesman" name="User" icon="terp-personal"
|
||||
domain="[]" context="{'group_by':'user_id'}" />
|
||||
|
||||
<filter string="Company" icon="terp-go-home"
|
||||
domain="[]"
|
||||
context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
|
||||
|
||||
<filter string="Section" icon="terp-personal+"
|
||||
<filter string="Sales Team" icon="terp-personal+"
|
||||
domain="[]"
|
||||
context="{'group_by':'section_id'}" />
|
||||
|
||||
|
||||
<separator orientation="vertical" />
|
||||
<filter string="State" icon="terp-stock_effects-object-colorize"
|
||||
domain="[]" context="{'group_by':'state'}" />
|
||||
|
||||
<filter string="Stage" icon="terp-stage" domain="[]"
|
||||
context="{'group_by':'stage_id'}" />
|
||||
|
||||
<filter string="Priority" icon="terp-rating-rated" domain="[]"
|
||||
context="{'group_by':'priority'}" />
|
||||
<filter string="Category" icon="terp-stock_symbol-selection"
|
||||
domain="[]" context="{'group_by':'categ_id'}" />
|
||||
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Priority" icon="terp-rating-rated" domain="[]"
|
||||
context="{'group_by':'priority'}" />
|
||||
<filter string="Type" icon="terp-stock_symbol-selection" domain="[]"
|
||||
<filter string="Type" icon="terp-stock_symbol-selection" domain="[]"
|
||||
context="{'group_by':'type_id'}" />
|
||||
|
||||
<filter string="State" icon="terp-stock_effects-object-colorize"
|
||||
domain="[]" context="{'group_by':'state'}" />
|
||||
<separator orientation="vertical" />
|
||||
<filter string="Company" icon="terp-go-home"
|
||||
domain="[]"
|
||||
context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
|
||||
|
||||
<separator orientation="vertical" />
|
||||
<filter string="Day" icon="terp-go-today"
|
||||
domain="[]" context="{'group_by':'day'}"/>
|
||||
domain="[]" context="{'group_by':'day'}"
|
||||
help="Date of claim"/>
|
||||
|
||||
<filter string="Month" icon="terp-go-month"
|
||||
domain="[]" context="{'group_by':'month'}" />
|
||||
domain="[]" context="{'group_by':'month'}"
|
||||
help="Month of claim"/>
|
||||
|
||||
<filter string="Year" icon="terp-go-year"
|
||||
domain="[]" context="{'group_by':'name'}" />
|
||||
domain="[]" context="{'group_by':'name'}"
|
||||
help="Year of claim"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended Filters..." groups="base.group_extended">
|
||||
<group expand="0" string="Extended Filters..." groups="base.group_extended">
|
||||
<filter icon="terp-dialog-close"
|
||||
string="Done"
|
||||
domain="[('state','=','done')]"/>
|
||||
|
@ -166,15 +170,16 @@
|
|||
<filter icon="gtk-cancel"
|
||||
string="Cancel"
|
||||
domain="[('state','=','cancel')]"/>
|
||||
|
||||
<group>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="stage_id" widget="selection" domain="[('object_id.model', '=', 'crm.claim')]"/>
|
||||
<field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.claim')]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="priority" />
|
||||
<field name="type_id" widget="selection" domain="[('object_id.model', '=', 'crm.claim')]"/>
|
||||
</group>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="partner_id"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="stage_id" widget="selection" domain="[('object_id.model', '=', 'crm.claim')]"/>
|
||||
<field name="categ_id" widget="selection" domain="[('object_id.model', '=', 'crm.claim')]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="priority" />
|
||||
<field name="type_id" widget="selection" domain="[('object_id.model', '=', 'crm.claim')]"/>
|
||||
<newline/>
|
||||
<field name="date_closed"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
|
@ -183,7 +188,7 @@
|
|||
<!-- CRM Claim Report Action -->
|
||||
|
||||
<record id="action_report_crm_claim" model="ir.actions.act_window">
|
||||
<field name="name">Claims</field>
|
||||
<field name="name">Claims Analysis</field>
|
||||
<field name="res_model">crm.claim.report</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,graph</field>
|
||||
|
|
Loading…
Reference in New Issue