odoo-viewodoo-13

Wrong value for ir.ui.menu.action on view side


i am new odoo dev. current i created new a model view and menu action i am not geting Error in model my custom modules work without a view when enabling view then occurred Error

model

class ResPartner(models.Model):
    _inherit = 'res.partner'
    partner_firstname = fields.Char(string="Partner Firstname")

View code

<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data>
        <record id="res_pr_forms" model="ir.ui.view">
           <field name="name">resPatientforms</field>
           <field name="model">res.partner</field>
           <field name="arch" type="xml">
               <form >
                   <sheet>
                       <group>
                           <field name="partner_firstname"/>
                       </group>
                   </sheet>
               </form>
           </field>
       </record>


        <!-- This Menu Item will appear in the Upper bar, That's why It needs NO parent or action -->
        <menuitem id="test_view_root" name="Test yvonne "  />
        <!-- This Menu Item must have a parent and an action -->
        <menuitem id="test_sub_categ" name="Test form Open" parent="test_view_root" action="res_pr_forms" sequence="15"/>
    </data>
</odoo>

Error

ValueError: Wrong value for ir.ui.menu.action: 'form,765'

raise ValueError("Wrong value for %s: %r" % (self, value)) odoo.tools.convert.ParseError: "Wrong value for ir.ui.menu.action: 'form,765'"


Solution

  • You need to provide a valid action (ir.actions.act_window) to the menu item, not a form view (ir.ui.view).

    Check the following example taken from Building a module/Actions and Menus:

        <?xml version="1.0" encoding="UTF-8"?>
    <odoo>
    
            <!-- window action -->
            <!--
                The following tag is an action definition for a "window action",
                that is an action opening a view or a set of views
            -->
            <record model="ir.actions.act_window" id="course_list_action">   <!-- Action definition -->
                <field name="name">Courses</field>
                <field name="res_model">openacademy.course</field>
                <field name="view_mode">tree,form</field>
                <field name="help" type="html">
                    <p class="o_view_nocontent_smiling_face">Create the first course
                    </p>
                </field>
            </record>
    
            <!-- top level menu: no parent -->
            <menuitem id="main_openacademy_menu" name="Open Academy"/>
            <!-- A first level in the left side menu is needed
                 before using action= attribute -->
            <menuitem id="openacademy_menu" name="Open Academy"
                      parent="main_openacademy_menu"/>
            <!-- the following menuitem should appear *after*
                 its parent openacademy_menu and *after* its
                 action course_list_action -->
            <menuitem id="courses_menu" name="Courses" parent="openacademy_menu"
                      action="course_list_action"/>                           <!-- specify the ation -->
            <!-- Full id location:
                 action="openacademy.course_list_action"
                 It is not required when it is the same module -->
    
    </odoo>