你可以简单地用CSS隐藏它......
.o_purchase_dashboard{
display: none !important;
}
仅在特定视图上隐藏它...
.o_list_view .o_purchase_dashboard, .o_kanban_view .o_purchase_dashboard{
display: none !important;
}
最后你必须将你的 css 文件包含在 __manifest__.py 中
"assets": {
"web.assets_backend":[
"path_to_your_file/purchase_dashboard.css",
]
}
您还可以通过使用 xml 文件修改 de 组件,使用更像 odoo 的方法来存档相同的结果...
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="my_module.PurchaseDashboard" t-inherit="purchase.PurchaseDashboard" t-inherit-mode="extension" owl="1">
<xpath expr="//div[hasclass('o_purchase_dashboard')]" position="attributes">
<attribute name="class" separator=" " add="d-none"></attribute>
</xpath>
</t>
</templates>
如果您想从视图中完全删除组件...
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-name="my_module.PurchaseListView" t-inherit="purchase.PurchaseListView" t-inherit-mode="extension" owl="1">
<xpath expr="//PurchaseDashBoard" position="replace">
</xpath>
</t>
</templates>
不要忘记在 __manifest__.py 中包含 de xml 文件
"assets": {
"web.assets_backend":[
"path_to_your_file/purchase_dashboard.xml",
]
}