Odoo14 action_set_won_rainbowman 不是对 crm.lead.result 的有效操作

Odoo14 action_set_won_rainbowman is not a valid action on crm.lead.result

我正在构建一个自定义模块以在 crm.lead 中包含树视图,它可以在其中插入一些数据,但是当我尝试安装它时出现以下问题。

action_set_won_rainbowman 不是对 crm.lead 的有效操作。结果

View name: lead.result.form
Error context:
 view: ir.ui.view(1405,)
 xmlid: lead_result_form
 view.model: crm.lead.result
 view.parent: ir.ui.view(536,)
 file: c:\users\rami\appdata\local\openerp s.a\odoo\addons.0\crm_lead_results\views\crm_lead_result.xml

如我所见

<record id="lead_result_form" model="ir.ui.view">
            <field name="name">lead.result.form</field>
            <field name="model">crm.lead.result</field>
            <field name="inherit_id" ref="crm.crm_lead_view_form" />
            <field name="arch" type="xml">
                <xpath expr="//page[@name='lead']" position="after">
                    <field name="results_ids">
                        <tree>
                            <field name="vendor_sort" />
                            <field name="vendor_name" />
                            <field name="vendor_amount" />
                        </tree>
                        <form>
                            <group col="4">
                                <field name="vendor_sort" />
                                <field name="vendor_name" required="1" />
                                <field name="vendor_amount" />
                            </group>
                        </form>
                    </field>
                </xpath>
            </field>
        </record>

我的模块看起来像

class LeadResults(models.Model):
    _name = "crm.lead.result"
    _description = "Lead Results"

    opp_id = fields.Many2one("crm.lead", "Oppurtunity")
    vendor_name = fields.Many2one('res.partner', string="Vendor", required=True, ondelete='cascade', index=True)
    vendor_amount = fields.Float(string='Amount', help="Vendor Amount")
    vendor_sort =  fields.Integer(string='Sort', help="Vendor Sort")



class CrmLead(models.Model):
    _inherit = "crm.lead"
    results_ids = fields.One2many("crm.lead.result", "opp_id", "Education")

任何人都可以帮我解决我错过的问题吗? “我只需要查看相同潜在客户 ID 的结果”...

提前致谢

您正在继承 crm.lead 的表单视图并给定 crm.lead 的模型 ID。结果。因此,将视图中的模型 id 更改为 crm.lead。此外,如果您想在笔记本中添加页面视图,则需要在 page 中添加 one2many 字段。请参见下面的示例。

<record id="lead_result_form" model="ir.ui.view">
        <field name="name">lead.result.form</field>
        <field name="model">crm.lead</field>
        <field name="inherit_id" ref="crm.crm_lead_view_form" />
        <field name="arch" type="xml">
            <xpath expr="//page[@name='lead']" position="after">
                <page name="results" string="Results"> 
                    <field name="results_ids">
                        <tree>
                            <field name="vendor_sort" />
                            <field name="vendor_name" />
                            <field name="vendor_amount" />
                        </tree>
                        <form>
                            <group col="4">
                                <field name="vendor_sort" />
                                <field name="vendor_name" required="1" />
                                <field name="vendor_amount" />
                            </group>
                        </form>
                    </field>
                </page>
            </xpath>
        </field>
    </record>