Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
3 Trả lời
1085 Lượt xem

Hello guys i have added a field in res.partner view and i want to hide some buttons in the header of res.partner view base on some conditions related to the field i've added   and those buttons are added by inherited view i tried somthings but not working so if any one knows how to do it respond please 😊

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

thanks for the respond brother im using odoo 18 and i found the solution thanks a lot

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hi,

Please check the code below:

<record id="view_partner_form" model="ir.ui.view">
<field name="name">res.partner.view.form.inherit</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath
expr="//div[hasclass('oe_button_box')]/button[@name='your_button_name']"
position="attributes">
<attribute name="invisible">Your condition</attribute>
</xpath>
</field>
</record>

Hope it helps.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hello, 

 You can customize ths code or send us your fields and the conditions you want


<xpath expr="//header/button[@name='your_button_action']" position="replace">

    <button name="your_button_action" string="Your Button"

            attrs="{'invisible': [('your_field', '=', False)]}"/>

</xpath>


Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 5 25
836
3
thg 3 25
1091
0
thg 11 24
1040
11
thg 1 24
13455
2
thg 3 15
8632