python - 父级上的 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
我创建的菜单没有出现在购买菜单中。有谁知道我错过了什么?
解决方案
检查以下原因:
- xml 文件是否添加到openerp .py 或menifest .py中?
- 检查是否在“设置 => 技术 => 用户界面 => 菜单项”中创建了菜单
注意:对于第二次检查,您需要启用开发者模式
推荐阅读
- android - 适用于 android 的最小 CMake 构建
- ios - 如何根据设备角度更改IOS中的显示亮度?
- java - OOP java Stack Overflow 来自被覆盖的方法
- android - Koin - 如何为浓缩咖啡测试提供模拟 ViewModel?
- html - 导航菜单覆盖普通列表项
- html - 网格自动流动密集不消除项目之间的差距
- c# - 使用字符串插值,如何填充给定字符?
- c# - 构造函数上的空引用异常
- c++ - 防止在复制构造函数中隐式调用基本构造函数
- python - 为什么我在导入 pdb 时会收到此错误?“模块”对象没有属性“ascii_letters”