我想将外部CSS文件添加到Odoo v8中。我的CSS改变了按钮的样式。
如何更改:
<button type="button" class="oe_button oe_form_button oe_highlight">...</button>
由:
<button type="button" class="oe_button oe_form_button oe_highlight new_class">...</button>
感谢。
答案 0 :(得分:0)
您可以通过从包含它的父视图继承按钮定义来覆盖该按钮定义。首先,您需要找到包含该按钮的父视图,然后在自定义视图中继承它,最后使用xpath或使用字段catch方法将该按钮替换为自定义按钮。
E.g
<record id="xyz_view_id" model="ir.ui.view">
<field name="name">mrp.production.form</field> <!-- name of the view change it to your desire -->
<field name="model">mrp.production</field> <!-- model of the view change it to your desired one -->
<field name="inherit_id" ref="mrp.view_mrp_form_abc"/> <!-- parent view which contains the button def -->
<field name="arch" type="xml">
<xpath expr="//button[@class='oe_button oe_form_button oe_highlight']" position="replace">
<button type="button" class="oe_button oe_form_button oe_highlight new_class">...</button>
</xpath>
</field>
<record>