how can i remove purchase order PurchaseDashBoard
in odoo 17
<templates>
<t t-name="purchase.PurchaseKanbanView" t-inherit="web.KanbanRenderer" t-inherit-mode="primary">
<xpath expr="//div[hasclass('o_kanban_renderer')]" position="before">
<PurchaseDashBoard />
</xpath>
</t>
</templates>
<templates>
<t t-name="purchase.PurchaseListView" t-inherit="web.ListRenderer" t-inherit-mode="primary">
<xpath expr="//div[hasclass('o_list_renderer')]" position="before">
<PurchaseDashBoard />
</xpath>
</t>
</templates>
You could simple hide it with css…
.o_purchase_dashboard{
display: none !important;
}
to only hide it on specific views…
.o_list_view .o_purchase_dashboard, .o_kanban_view .o_purchase_dashboard{
display: none !important;
}
Finally you must include your css file in the __manifest__.py
"assets": {
"web.assets_backend":[
"path_to_your_file/purchase_dashboard.css",
]
}
Also you could archive the same result using a more odoo like aproach by modifying de component using an xml file…
<?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>
and if you want to remove the component completely from a view…
<?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>
Don’t forget to include de xml file in the __manifest__.py
"assets": {
"web.assets_backend":[
"path_to_your_file/purchase_dashboard.xml",
]
}
You just need to remove an attribute of the <tree>
node of the main view purchase.purchase_order_kpis_tree
.
<record id="purchase_order_kpis_tree" model="ir.ui.view">
<field name="name">view.purchase.order.tree.inherit.remove_dashboard</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_kpis_tree" />
<field name="arch" type="xml">
<tree position="attributes">
<attribute name="js_class" />
</tree>
</field>
</record>
That will remove the attribute js_class
from the purchase order list view which will remove the dashboard.