Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3 ตอบกลับ
1095 มุมมอง

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 😊

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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>


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
พ.ค. 25
838
3
มี.ค. 25
1094
0
พ.ย. 24
1041
Creating new view from a old view แก้ไขแล้ว
11
ม.ค. 24
13459
2
มี.ค. 15
8641