Home > Software engineering >  Odoo14 action_set_won_rainbowman is not a valid action on crm.lead.result
Odoo14 action_set_won_rainbowman is not a valid action on crm.lead.result

Time:05-30

I'm building a custom module to include tree view inside crm.lead that can insert few data inside, but when i try to install it i got the following issue.

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

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\14.0\crm_lead_results\views\crm_lead_result.xml

as my view looks like

<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>

and my module looks like

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")

can anyone help me what i missed in that? "i need only to view results for same lead id"...

Thanks in advance

CodePudding user response:

You are inheriting form view of crm.lead and given model id of crm.lead.result. So, change model id to crm.lead in view. Also if you want to add page view inside notebook then you need to add your one2many field inside page .see below example.

<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>
  • Related