gpt4 book ai didi

python - Openerp中Lead的onclick无法获取自定义模块中Lead的详细信息

转载 作者:行者123 更新时间:2023-12-01 05:24:21 35 4
gpt4 key购买 nike

我正在创建一个自定义模块并尝试将潜在客户转换为机会。现在我正在获取所有潜在客户并像 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)
}

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>

img1

img2

img3

最佳答案

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

所以首先要采取行动:

<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 部分(错误所属的记录)输出之前转到堆栈跟踪,您将主要找到真正的错误消息,例如“找不到模型 anymodel 中的字段 anyfield"

关于python - Openerp中Lead的onclick无法获取自定义模块中Lead的详细信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21673536/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com