parent
60c9ef812a
commit
22dae2b3f8
|
@ -2,10 +2,9 @@ from osv import fields,osv
|
|||
import tools
|
||||
|
||||
class crm_opportunity_report(osv.osv):
|
||||
_name = "crm.opportunity.report"
|
||||
_name = "crm.opportunity.report"
|
||||
_auto = False
|
||||
_inherit = "crm.case.report"
|
||||
|
||||
_inherit = "crm.case.report"
|
||||
_columns = {
|
||||
'probability': fields.float('Avg. Probability', readonly=True),
|
||||
'amount_revenue': fields.float('Est.Revenue', readonly=True),
|
||||
|
@ -35,13 +34,20 @@ class crm_opportunity_report(osv.osv):
|
|||
0 as avg_answers,
|
||||
0.0 as perc_done,
|
||||
0.0 as perc_cancel,
|
||||
sum(planned_revenue) as amount_revenue,
|
||||
sum(planned_revenue) as amount_revenue,
|
||||
sum((planned_revenue*probability)/100.0)::decimal(16,2) as amount_revenue_prob,
|
||||
avg(probability)::decimal(16,2) as probability,
|
||||
to_char(avg(date_closed-c.create_date), 'DD"d" HH24:MI:SS') as delay_close
|
||||
from
|
||||
crm_opportunity c
|
||||
group by to_char(c.create_date, 'YYYY'), to_char(c.create_date, 'MM'), c.state, c.user_id,c.section_id,c.stage_id,c.categ_id,c.partner_id,company_id
|
||||
group by
|
||||
to_char(c.create_date, 'YYYY'),
|
||||
to_char(c.create_date, 'MM'),
|
||||
c.state,
|
||||
c.user_id,
|
||||
c.section_id,
|
||||
c.stage_id,
|
||||
c.categ_id,
|
||||
c.partner_id,company_id
|
||||
)""")
|
||||
crm_opportunity_report()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
Loading…
Reference in New Issue