视图侧的 ir.ui.menu.action 值错误

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

我是新的odoo开发者。目前我创建了一个新的模型视图和菜单操作我没有在模型中出现错误 启用视图时,我的自定义模块在没有视图的情况下工作,然后发生错误

型号

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

查看代码

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

错误

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

您需要为菜单项提供有效的操作 (ir.actions.act_window),而不是表单视图 (ir.ui.view)。

检查以下取自 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>