首页 > 解决方案 > 父级上的 Odoo 扩展菜单项不会出现

问题描述

我正在使用 odoo8,并在购买时创建新菜单。我正在创建一个继承类的新purchses.order.line类:

class PurchaseOrderLine(models.Model):
   _inherit = 'purchase.order.line'

   order_name = fields.Char(string='PO Number', related='order_id.name')
   order_date = fields.Datetime(string='Date Order', related='order_id.date_order')
   vendor = fields.Char(string='Vendor', related='order_id.partner_id.name')
   internal_category_product = fields.Char(string='Internal Category Product', related='product_id.categ_id.name')
   internal_reference_product = fields.Char(string='Internal Referece Product', related='product_id.default_code')
   name_product = fields.Char(string='Product', related='product_id.name')

并提出行动和意见:

<record id="report_my_purchase_tree_view" model="ir.ui.view">
        <field name="name">report.my.purchase.tree.view</field>
        <field name="model">purchase.order.line</field>
        <field name="arch" type="xml">
            <tree string="My Purchases Report">
                <field name="order_name" />
                <field name="order_date" />
                <field name="vendor" />
                <field name="internal_category_product" />
                <field name="internal_reference_product" />
                <field name="name_product" />
                <field name="product_qty" />
                <field name="price_unit" />
                <field name="price_total" />
            </tree>
        </field>
    </record>

    <record id="action_report_my_purchase" model="ir.actions.act_window">
        <field name="name">Report My Purchase</field>
        <field name="res_model">purchase.order.line</field>
        <field name="view_type">form</field>
        <field name="view_mode">tree,pivot</field>
    </record>

并尝试将它们附加到购买菜单中:

<menuitem name="My Purchase Report" id="menu_report_my_purchase" parent="purchase.menu_procurement_management" action="action_report_my_purchase" />

在我更新模块后,odoo 没有显示错误,但是My Purchase Report我创建的菜单没有出现在购买菜单中。有谁知道我错过了什么?

标签: pythonxmlodooodoo-8

解决方案


检查以下原因:

  1. xml 文件是否添加到openerp .py 或menifest .py
  2. 检查是否在“设置 => 技术 => 用户界面 => 菜单项”中创建了菜单

注意:对于第二次检查,您需要启用开发者模式


推荐阅读