Odoo 15:类型错误:无法读取未定义的属性(读取“类型”)

问题描述 投票:0回答:1

我正在使用 Odoo 15,在尝试访问 Odoo 中的销售点菜单时遇到持续存在的问题,我希望有人能够提供解决该问题的指导。

这是我遇到的错误消息:

 TypeError: Cannot read properties of undefined (reading 'type')
    at ControlPanelModelExtension._extractAttributes (http://localhost:5050/web/assets/debug/web.assets_backend.js:45261:46)
    at http://localhost:5050/web/assets/debug/web.assets_backend.js:45117:26 (/web/static/src/legacy/js/control_panel/control_panel_model_extension.js:959)
    at Array.forEach (<anonymous>) (/web/static/src/legacy/js/control_panel/control_panel_model_extension.js:815)
    at ControlPanelModelExtension._createGroupOfFiltersFromArch (http://localhost:5050/web/assets/debug/web.assets_backend.js:45074:24) (/web/static/src/legacy/js/control_panel/control_panel_model_extension.js:772)
    at ControlPanelModelExtension._addFilters (http://localhost:5050/web/assets/debug/web.assets_backend.js:44900:18) (/web/static/src/legacy/js/control_panel/control_panel_model_extension.js:598)
    at ControlPanelModelExtension.prepareState (http://localhost:5050/web/assets/debug/web.assets_backend.js:44523:22) (/web/static/src/legacy/js/control_panel/control_panel_model_extension.js:221)
    at ControlPanelModelExtension.importState (http://localhost:5050/web/assets/debug/web.assets_backend.js:93594:22) (/web/static/src/legacy/js/model.js:81)
    at ActionModel.importState (http://localhost:5050/web/assets/debug/web.assets_backend.js:93873:27) (/web/static/src/legacy/js/model.js:360)
    at new Model (http://localhost:5050/web/assets/debug/web.assets_backend.js:93769:18) (/web/static/src/legacy/js/model.js:256)
    at new ActionModel (http://localhost:5050/web/assets/debug/web.assets_backend.js:63508:5) (/web/static/src/legacy/js/views/action_model.js:59)

我尝试创建新数据库,更新 Odoo 源代码,但问题仍然存在,并且在安装自定义模块后始终出现。重要的是,该模块与 POS 模块无关,并且不包含任何 JavaScript 代码。 任何有关可能导致此问题的原因的见解将不胜感激。

预先感谢您的协助!

javascript odoo odoo-15 point-of-sale
1个回答
0
投票

如果您的菜单项调用的窗口操作已定义 view_type 字段,请将其删除。

<record model="ir.actions.act_window" id="action_example">
    <field name="name">Example Action</field>
    <field name="res_model">action.example</field>
    <field name="view_type">form</field>   <-- this is the problem
    <field name="view_mode">tree,form</field>
    <field name="target">current</field>
    <field name="context">{'search_default_today': True}</field>
</record>

<!-- This is the correct version of the window action -->
<record model="ir.actions.act_window" id="action_example">
    <field name="name">Example Action</field>
    <field name="res_model">action.example</field>
    <field name="view_mode">tree,form</field>
    <field name="target">current</field>
    <field name="context">{'search_default_today': True}</field>
</record>

<menuitem
    id="example_menu_item
    name="Example"
    action="action_example"/>

如果这不起作用,请检查相应模型上定义的任何搜索记录。如果这些记录按视图中不存在的字段进行分组,则可能会出现此不明确的错误。

© www.soinside.com 2019 - 2024. All rights reserved.