父级上的Odoo扩展菜单项不会出现

时间:2018-10-15 10:04:33

标签: python xml odoo odoo-8

我正在使用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菜单没有出现在“购买”菜单中。有谁知道我错过了什么?

1 个答案:

答案 0 :(得分:0)

请检查以下原因:

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

注意:对于第二项检查,您将需要启用开发人员模式