0

我是新的 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:ir.ui.menu.action 的值错误:'form,765'

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

4

1 回答 1

0

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

检查以下从构建模块/操作和菜单中获取的示例:

    <?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>
于 2020-01-30T13:53:12.590 回答