我正在创建一个自定义模块,并尝试将潜在客户转换为机会。现在我正在获取所有潜在客户并在img1中显示。但实际上我想显示像img2,点击任何线索它应该带我像img3这样的simlar scrren我可以选择将潜在客户转换为机会。我的问题是点击img1中的任何线索,没有回应。谢谢提前。 我的代码是
lead.py
from osv import osv
from osv import fields
class crm_lead(osv.osv):
_name = 'crm.lead'
_inherit = 'crm.lead'
_description = "adding fields to crm.lead"
_columns = {
'nitesh_lead': fields.char('Nitesh Lead',size=64),
'lead_source': fields.many2one('crm.lead.source','Lead Source'),
'lead_status': fields.many2one('crm.lead.status','Lead Status')
}
class res_partner_title(osv.osv):
_name = 'crm.lead.source'
_order = 'name'
_columns = {
'name': fields.char('Source', required=True, size=46, translate=True)
}
class res_partner_title(osv.osv):
_name = 'crm.lead.status'
_order = 'name'
_columns = {
'name': fields.char('Status', required=True, size=46, translate=True)
}
lead_view.xml
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- ========================This is Form layout===============================-->
<record id="crm_case_tree_view_oppor_extended" model="ir.ui.view">
<field name="name">Opportunities Tree</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_case_tree_view_oppor" />
<field name="arch" type="xml">
<field name="planned_revenue" position="replace"/>
<field name="probability" position="replace"/>
</field>
</record>
<record id="crm_case_form_view_leads_extended" model="ir.ui.view">
<field name="name">CRM - Leads Form</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_case_form_view_leads" />
<field name="arch" type="xml">
<field name="email_from" postion="replace"/>
<field name="contact_name" position="replace"/>
<label for="contact_name" position="replace">
<br/>
</label>
<xpath expr="//label[@for='street']" position="before">
<field name="contact_name"/>
</xpath>
<xpath expr="//label[@for='section_id']" position="before">
<field name="lead_source"/>
<field name="lead_status"/>
</xpath>
<field name="function" position="replace"/>
<field name="partner_name" position="replace"/>
<field name="priority" position="replace"/>
<field name="categ_ids" position="replace"/>
<field name="partner_id" position="replace"/>
</field>
</record>
<!-- ===========================Action layout=========================== -->
<record id="new_lead" model="ir.actions.act_window">
<field name="name">Lead</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">crm.lead</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name="view_id" ref="crm_case_form_view_leads_extended"/>
</record>
<record id="show_lead" model="ir.actions.act_window">
<field name="name">Lead</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">crm.lead</field>
<field name="view_type">tree</field>
<field name="view_mode">tree</field>
<field name="view_id" ref="crm_case_tree_view_oppor_extended"/>
</record>
<!-- ===========================Menu Settings=========================== -->
<menuitem name ="Lead" id = "menu_lead" />
<menuitem name="Leads" id="sub_menu_lead" parent="menu_lead" />
<menuitem name="Create Lead" id="create_lead" parent="sub_menu_lead" action="new_lead"/>
<menuitem name="Show Lead" id="show_leads" parent="sub_menu_lead" action="show_lead"/>
</data>
</openerp>
答案 0 :(得分:2)
您只需要一个menuitem来显示您的潜在客户(您可以在其中创建)。
首先是行动:
<record id="show_lead" model="ir.actions.act_window">
<field name="name">Lead</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">crm.lead</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name="view_id" ref="crm_case_tree_view_oppor_extended"/>
</record>
和menuitem:
<menuitem name="Show Lead" id="show_leads" parent="sub_menu_lead" action="show_lead"/>
只需删除create_lead操作和menuitem
即可还有一点提示:如果你有xml错误,请在输出xml部分(错误所属的记录)之前转到stacktrace riiiiight,你会发现真正的错误信息,比如“找不到模型中的字段 anyfield anymodel “