1

我正在创建一个自定义模块并尝试将潜在客户转换为机会。现在我正在获取所有潜在客户并在 img1 中显示。但实际上我想像 img2 一样显示,点击任何潜在客户时,它应该带我到类似 img3 的屏幕,我可以选择将潜在客户转换为机会。我的问题是点击 img1 中的任何线索,没有响应。在此先感谢。我的代码是

铅.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)
    }

铅视图.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>

图像1

img2

图像3

4

1 回答 1

2

您只需要一个菜单​​项来显示您的潜在客户(您可以在其中创建)。

所以首先行动:

<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 name="Show Lead" id="show_leads" parent="sub_menu_lead" action="show_lead"/>

只需删除 create_lead 操作和 menuitem

和一点提示:如果您遇到 xml 错误,请在输出 xml 部分(错误所属的记录)之前转到 stacktrace riiiiight,您会发现真正的错误消息,例如“can't find field anyfield in模型任何模型“

于 2014-02-10T11:02:43.573 回答