如何在Odoo 17中移除采购订单的PurchaseDashBoard
在Odoo 17中移除采购订单模块的PurchaseDashBoard
你提供的代码片段是Odoo采购模块中,为看板视图和列表视图添加PurchaseDashBoard的模板继承逻辑。要移除这个仪表盘,我们可以通过模板继承替换/删除目标节点的方式实现,具体步骤如下:
解决方案代码
移除看板视图中的仪表盘
在自定义模块的视图文件中添加以下XML代码:
<templates> <t t-name="custom_purchase.RemoveKanbanDashboard" t-inherit="purchase.PurchaseKanbanView" t-inherit-mode="extension"> <xpath expr="//PurchaseDashBoard" position="replace"/> </t> </templates>
移除列表视图中的仪表盘
同样在自定义模块的视图文件中添加:
<templates> <t t-name="custom_purchase.RemoveListDashboard" t-inherit="purchase.PurchaseListView" t-inherit-mode="extension"> <xpath expr="//PurchaseDashBoard" position="replace"/> </t> </templates>
操作步骤
- 新建自定义模块(示例命名为
custom_purchase),在__manifest__.py中添加依赖:'depends': ['purchase'] - 在模块的
views目录下创建上述XML文件(如purchase_remove_dashboard.xml) - 在
__manifest__.py的data列表中注册该文件:'data': ['views/purchase_remove_dashboard.xml'] - 升级自定义模块,采购订单的看板和列表视图中的仪表盘将被移除
界面参考

内容的提问来源于stack exchange,提问作者Ahmed Tahsen
相关产品推荐
相关产品推荐

