<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>
'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 = {
break
return res
+
class crm_lead_tag(osv.Model):
_name = "crm.lead.tag"
_description = "Category of lead"
'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),
+ }
</group>
<group>
<field name="tag_ids" widget="many2many_tags"/>
+ <field name="lost_reason"/>
</group>
</group>
<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)]"/>
<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>
<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>
('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):
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'
<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>
access_crm_lead_tag_manager,crm_lead_tag manager,model_crm_lead_tag,base.group_sale_manager,1,1,1,1\r
access_crm_phonecall_category,crm_phonecall_category,model_crm_phonecall_category,base.group_user,1,0,0,0\r
access_crm_phonecall_category_salesman,crm_phonecall_category salesman,model_crm_phonecall_category,base.group_sale_salesman,1,1,1,0\r
-access_crm_phonecall_category_manager,crm_phonecall_category manager,model_crm_phonecall_category,base.group_sale_manager,1,1,1,1
\ No newline at end of file
+access_crm_phonecall_category_manager,crm_phonecall_category manager,model_crm_phonecall_category,base.group_sale_manager,1,1,1,1\r
+access_crm_lost_reason,crm.lost.reason,model_crm_lost_reason,base.group_sale_manager,1,1,1,1\r
+access_crm_lost_reason,crm.lost.reason,model_crm_lost_reason,base.group_sale_salesman,1,1,1,0\r
+access_crm_lost_reason,crm.lost.reason,model_crm_lost_reason,base.group_user,1,0,0,0
\ No newline at end of file