[IMP] crm: added reason for loosing opportunities
This commit is contained in:
committed by
Thibault Delavallée
parent
17937e7e92
commit
c92d86e02d
@@ -76,6 +76,16 @@
|
||||
<p>To manage quotations and sale orders, install the "Sales Management" application.</p>]]></field>
|
||||
</record>
|
||||
|
||||
<!-- opportunities' lost causes -->
|
||||
<record model="crm.lost.reason" id="lost_reason_1">
|
||||
<field name="name">Too expensive</field>
|
||||
</record>
|
||||
<record model="crm.lost.reason" id="lost_reason_2">
|
||||
<field name="name">We don't have people/skills</field>
|
||||
</record>
|
||||
<record model="crm.lost.reason" id="lost_reason_3">
|
||||
<field name="name">Not enough stock</field>
|
||||
</record>
|
||||
</data>
|
||||
|
||||
</openerp>
|
||||
|
||||
+10
-1
@@ -272,6 +272,7 @@ class crm_lead(format_address, osv.osv):
|
||||
'company_id': fields.many2one('res.company', 'Company', select=1),
|
||||
'planned_cost': fields.float('Planned Costs'),
|
||||
'meeting_count': fields.function(_meeting_count, string='# Meetings', type='integer'),
|
||||
'lost_reason': fields.many2one('crm.lost.reason', 'Lost Reason', select=True, track_visibility='onchange')
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
@@ -1085,6 +1086,7 @@ class crm_lead(format_address, osv.osv):
|
||||
break
|
||||
return res
|
||||
|
||||
|
||||
class crm_lead_tag(osv.Model):
|
||||
_name = "crm.lead.tag"
|
||||
_description = "Category of lead"
|
||||
@@ -1093,4 +1095,11 @@ class crm_lead_tag(osv.Model):
|
||||
'team_id': fields.many2one('crm.team', 'Sales Team'),
|
||||
}
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
class crm_lost_reason(osv.Model):
|
||||
_name = "crm.lost.reason"
|
||||
_description = 'Reason for loosing leads'
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Name', required=True),
|
||||
}
|
||||
|
||||
@@ -450,6 +450,7 @@
|
||||
</group>
|
||||
<group>
|
||||
<field name="tag_ids" widget="many2many_tags"/>
|
||||
<field name="lost_reason"/>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
@@ -558,6 +559,7 @@
|
||||
<field name="partner_id" operator="child_of"/>
|
||||
<field name="stage_id" domain="[]"/>
|
||||
<field name="probability"/>
|
||||
<field name="lost_reason"/>
|
||||
<separator/>
|
||||
<filter string="New" name="new"
|
||||
domain="[('probability', '=', 0), ('stage_id.sequence', '<=', 1)]"/>
|
||||
@@ -585,6 +587,7 @@
|
||||
<separator orientation="vertical" />
|
||||
<filter string="Creation Month" context="{'group_by':'create_date:month'}" name="month"/>
|
||||
<filter string="Expected Closing" context="{'group_by':'date_deadline'}"/>
|
||||
<filter string="Lost Reason" context="{'group_by':'lost_reason'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
|
||||
+31
-1
@@ -107,8 +107,38 @@
|
||||
|
||||
<menuitem action="crm_tracking_source_action" id="menu_crm_tracking_source" parent="base.menu_crm_config_lead" sequence="4" groups="base.group_no_one"/>
|
||||
|
||||
<!-- CRM STAGE VIEWS -->
|
||||
<!-- CRM.LOST.REASON VIEWS -->
|
||||
<record id="crm_lost_reason_view_form" model="ir.ui.view">
|
||||
<field name="name">crm.lost.reason.form</field>
|
||||
<field name="model">crm.lost.reason</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Channel">
|
||||
<group>
|
||||
<field name="name"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record id="crm_lost_reason_action" model="ir.actions.act_window">
|
||||
<field name="name">Lost Reasons</field>
|
||||
<field name="res_model">crm.lost.reason</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to define a new lost reason.
|
||||
</p><p>
|
||||
Use lost reasons to explain why an opportunity is lost.
|
||||
</p><p>
|
||||
Some examples of lost reasons: "We don't have people/skill", "Price too high"
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="crm_lost_reason_action" id="menu_crm_lost_reason" parent="base.menu_crm_config_lead" sequence="6" groups="base.group_no_one"/>
|
||||
|
||||
|
||||
<!-- CRM STAGE VIEWS -->
|
||||
<record model="ir.ui.view" id="crm_stage_tree">
|
||||
<field name="name">crm.stage.tree</field>
|
||||
<field name="model">crm.stage</field>
|
||||
|
||||
@@ -60,6 +60,7 @@ class crm_opportunity_report(osv.Model):
|
||||
('lead','Lead'),
|
||||
('opportunity','Opportunity'),
|
||||
],'Type', help="Type is used to separate Leads and Opportunities"),
|
||||
'lost_reason': fields.many2one('crm.lost.reason', 'Lost Reason', readonly=True),
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
@@ -93,7 +94,8 @@ class crm_opportunity_report(osv.Model):
|
||||
c.create_date as create_date,
|
||||
extract('epoch' from (c.date_closed-c.create_date))/(3600*24) as delay_close,
|
||||
abs(extract('epoch' from (c.date_deadline - c.date_closed))/(3600*24)) as delay_expected,
|
||||
extract('epoch' from (c.date_open-c.create_date))/(3600*24) as delay_open
|
||||
extract('epoch' from (c.date_open-c.create_date))/(3600*24) as delay_open,
|
||||
c.lost_reason
|
||||
FROM
|
||||
crm_lead c
|
||||
WHERE c.active = 'true'
|
||||
|
||||
@@ -97,6 +97,7 @@
|
||||
<separator orientation="vertical" />
|
||||
<filter string="Creation Month" context="{'group_by':'create_date:month'}" name="month"/>
|
||||
<filter string="Expiration Closing" context="{'group_by':'date_deadline:month'}" name="month" help="Expiration Closing Month"/>
|
||||
<filter string="Lost Reason" context="{'group_by':'lost_reason'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
|
||||
@@ -28,4 +28,7 @@ access_crm_lead_tag_salesman,crm_lead_tag salesman,model_crm_lead_tag,base.group
|
||||
access_crm_lead_tag_manager,crm_lead_tag manager,model_crm_lead_tag,base.group_sale_manager,1,1,1,1
|
||||
access_crm_phonecall_category,crm_phonecall_category,model_crm_phonecall_category,base.group_user,1,0,0,0
|
||||
access_crm_phonecall_category_salesman,crm_phonecall_category salesman,model_crm_phonecall_category,base.group_sale_salesman,1,1,1,0
|
||||
access_crm_phonecall_category_manager,crm_phonecall_category manager,model_crm_phonecall_category,base.group_sale_manager,1,1,1,1
|
||||
access_crm_phonecall_category_manager,crm_phonecall_category manager,model_crm_phonecall_category,base.group_sale_manager,1,1,1,1
|
||||
access_crm_lost_reason,crm.lost.reason,model_crm_lost_reason,base.group_sale_manager,1,1,1,1
|
||||
access_crm_lost_reason,crm.lost.reason,model_crm_lost_reason,base.group_sale_salesman,1,1,1,0
|
||||
access_crm_lost_reason,crm.lost.reason,model_crm_lost_reason,base.group_user,1,0,0,0
|
||||
|
Reference in New Issue
Block a user