[IMP] crm_fundraising:-useability improvements as defined on etherpad
bzr revid: mtr@mtr-20100920135910-1lcgn6fb87ze59ev
This commit is contained in:
parent
cb99949fa3
commit
370ec5aac4
|
@ -61,6 +61,10 @@ class crm_fundraising_report(osv.osv):
|
|||
'delay_close': fields.float('Delay to close', digits=(16,2),readonly=True, group_operator="avg",help="Number of Days to close the case"),
|
||||
'partner_id': fields.many2one('res.partner', 'Partner'),
|
||||
'company_id': fields.many2one('res.company', 'Company'),
|
||||
'type_id': fields.many2one('crm.case.resource.type', 'Fundraising Type', \
|
||||
domain="[('section_id','=',section_id),\
|
||||
('object_id.model', '=', 'crm.fundraising')]"),
|
||||
'planned_cost': fields.float('Planned Costs',readonly=True,digits=(16,2)),
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
|
@ -74,26 +78,28 @@ class crm_fundraising_report(osv.osv):
|
|||
create or replace view crm_fundraising_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,
|
||||
c.state,
|
||||
c.user_id,
|
||||
c.section_id,
|
||||
c.categ_id,
|
||||
c.type_id,
|
||||
c.company_id,
|
||||
c.partner_id,
|
||||
count(*) as nbr,
|
||||
date_trunc('day',c.create_date) as create_date,
|
||||
sum(planned_revenue) as amount_revenue,
|
||||
sum(planned_cost) as planned_cost,
|
||||
sum(planned_revenue*probability)::decimal(16,2) as amount_revenue_prob,
|
||||
avg(probability)::decimal(16,2) as probability,
|
||||
avg(extract('epoch' from (c.date_closed-c.create_date)))/(3600*24) as delay_close
|
||||
from
|
||||
crm_fundraising c
|
||||
group by to_char(c.create_date, 'YYYY'), to_char(c.create_date, 'MM'),\
|
||||
c.state, c.user_id,c.section_id,c.categ_id,c.partner_id,c.company_id,
|
||||
c.create_date,to_char(c.create_date, 'YYYY-MM-DD')
|
||||
group by to_char(c.date, 'YYYY'), to_char(c.date, 'MM'),\
|
||||
c.state, c.user_id,c.section_id,c.categ_id,type_id,c.partner_id,c.company_id,
|
||||
c.create_date,to_char(c.date, 'YYYY-MM-DD')
|
||||
)""")
|
||||
|
||||
crm_fundraising_report()
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<field name="model">crm.fundraising.report</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree colors="blue:state in ('draft');black:state in ('open','pending');gray:state in ('done','cancel') " string="Fundraising">
|
||||
<tree string="Fundraising">
|
||||
<field name="name" invisible="1"/>
|
||||
<field name="month" invisible="1"/>
|
||||
<field name="section_id" invisible="1"/>
|
||||
|
@ -17,6 +17,7 @@
|
|||
<field name="company_id" invisible="1"/>
|
||||
<field name="partner_id" invisible="1"/>
|
||||
<field name="nbr" string='#Fundraising' sum="#Fundraising"/>
|
||||
<field name="planned_cost" sum='Planned Costs'/>
|
||||
<field name="amount_revenue" sum='Est.Revenue'/>
|
||||
<field name="probability" avg='Avg. Probability' widget="progressbar"/>
|
||||
<field name="amount_revenue_prob" sum='Est. Rev*Prob.'/>
|
||||
|
@ -24,6 +25,7 @@
|
|||
<field name="state" invisible="1"/>
|
||||
<field name="categ_id" invisible="1"/>
|
||||
<field name="day" invisible="1"/>
|
||||
<field name="type_id" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
||||
|
@ -74,14 +76,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="Funds raised 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="Funds raised 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="Funds raised in the previous month"/>
|
||||
|
||||
<separator orientation="vertical" />
|
||||
<filter icon="terp-document-new"
|
||||
|
@ -97,7 +102,6 @@
|
|||
<separator orientation="vertical" />
|
||||
<field name="section_id"
|
||||
default="context.get('section_id', False)"
|
||||
widget="selection"
|
||||
context="{'invisible_section': False}">
|
||||
|
||||
<filter icon="terp-personal+"
|
||||
|
@ -106,46 +110,51 @@
|
|||
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'}" />
|
||||
|
||||
<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"
|
||||
<filter string="State" icon="terp-stock_effects-object-colorize"
|
||||
domain="[]" context="{'group_by':'state'}" />
|
||||
|
||||
<filter string="Category" icon="terp-stock_symbol-selection"
|
||||
domain="[]" context="{'group_by':'categ_id'}" />
|
||||
|
||||
<filter string="Payment Mode" help="Payment Mode"
|
||||
icon="terp-dolar" domain="[]"
|
||||
context="{'group_by':'type_id'}" />
|
||||
<separator orientation="vertical" />
|
||||
<filter string="Company" icon="terp-go-home"
|
||||
domain="[]"
|
||||
context="{'group_by':'company_id'}" />
|
||||
|
||||
<separator orientation="vertical" />
|
||||
<filter string="Day" icon="terp-go-today"
|
||||
domain="[]" context="{'group_by':'day'}"/>
|
||||
domain="[]" context="{'group_by':'day'}"
|
||||
help="Day on which fund is raised"/>
|
||||
|
||||
<filter string="Month" icon="terp-go-month"
|
||||
domain="[]" context="{'group_by':'month'}" />
|
||||
domain="[]" context="{'group_by':'month'}"
|
||||
help="Month in which fund is raised"/>
|
||||
|
||||
<filter string="Year" icon="terp-go-year"
|
||||
domain="[]" context="{'group_by':'name'}" />
|
||||
domain="[]" context="{'group_by':'name'}"
|
||||
help="Year in which fund is raised"/>
|
||||
|
||||
</group>
|
||||
<newline/>
|
||||
|
@ -170,7 +179,7 @@
|
|||
<!-- Fundraising by user and section Action -->
|
||||
|
||||
<record id="action_report_crm_fundraising" model="ir.actions.act_window">
|
||||
<field name="name">Fundraising</field>
|
||||
<field name="name">Fundraising Analysis</field>
|
||||
<field name="res_model">crm.fundraising.report</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,graph</field>
|
||||
|
|
Loading…
Reference in New Issue