I created 2 buttons in form and kanban view that all inherited res.partner.
I created field.char betwenn <button></button> to show data.
def create function is used to assign data to "show" field.
I want to hide buttons when "show" field has empty string.
I used attrs="{'invisible': [('show', '=','')]}" but it doesn't work.
## IN .xml file
<odoo>
<data>
<!--Add Similar Button in Form View-->
<record id="similar_list_view_partner_form"
model="ir.ui.view">
<field name="name">similar_list_view_partner_form</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"></field>
<field name="arch" type="xml">
<xpath expr="//button[@name='toggle_active'][not(ancestor::field)]" position="after">
<button class="oe_stat_button" name="similar_list_button_action" type="object" icon="fa-align-justify" attrs="{'invisible': [('show', '=','')]}">
<field name="show" attrs="{'invisible': [('show', '=','')]}" readonly="1"/>
</xpath>
</field>
</record>
<!--Add show field in kanban view-->
<record id="similar_list_view_partner_kanban" model="ir.ui.view">
<field name="name">similar_list_view_partner_kanban</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.res_partner_kanban_view"></field>
<field name="arch" type="xml">
<xpath expr="//div[contains(@class, 'o_kanban_tags_section oe_kanban_partner_categories')]" position="after">
<button class="btn btn-link btn-xs" name="%(similar_list_button_action)d" type="object" attrs="{'invisible': [('show', '=','')]}">
<field name="show" attrs="{'invisible': [('show', '=','')]}" readonly="1"/>
</button>
</xpath>
</field>
</record>
</data>
</odoo>
##in .py file
class similar_contact(models.Model):
_inherit= 'res.partner'
show=fields.Char()
@api.model
def create(self, values):
----------