I am using odoo 10. I have a customer view and in that customer form view i am also showing all order that are associated with that specific customer in one2many tree view (editable).
What i want to do is i want to show a button in one2many tree view but i want to change that button's color only based on condition.
Here is what i tried but its not working.
<record id="amgl.customer_form" model="ir.ui.view">
<field name="name">Customer</field>
<field name="model">amgl.customer</field>
<field name="arch" type="xml">
<form string="Create New Customer" duplicate="0">
<sheet>
<group colspan="4">
<group>
<field name="is_admin" invisible="1"/>
<field name="is_custodian" invisible="1"/>
<field name="is_vault" invisible="1"/>
<field name="is_o2m" invisible="1"/>
<field name="is_goldstar" invisible="1"/>
<field name="custodian_edit" invisible="1"/>
<field name="first_name"
attrs="{'readonly':['|',('is_vault','=', True),('custodian_edit','=', True),('is_admin','=', False)]}"/>
<field name="last_name"
attrs="{'readonly':['|',('is_vault','=', True),('custodian_edit','=', True),('is_admin','=', False)]}"/>
<field name="account_number"
attrs="{'readonly':['|',('is_vault','=', True),('custodian_edit','=', True),('is_admin','=', False)]}"/>
<field name="gst_account_number" string="GoldStar Account Number"
attrs="{'readonly':['|',('is_vault','=', True),('custodian_edit','=', True),('is_admin','=', False)], 'invisible':[('is_goldstar','=',False)]}"/>
</group>
<group>
<field name="date_opened"
attrs="{'readonly':['|',('is_vault','=', True),('custodian_edit','=', True),('is_admin','=', False)]}"/>
<field name="account_type"
attrs="{'readonly':['|',('is_vault','=', True),('custodian_edit','=', True),('is_admin','=', False)]}"/>
<field name="custodian_id" options='{"no_open": True}'
attrs="{'readonly':[('is_admin','=', False)]}"/>
<field name="customer_notes"
attrs="{'readonly':['|',('is_vault','=', True),('custodian_edit','=', True),('is_admin','=', False)]}"/>
</group>
</group>
<notebook>
<!--CURRENT INVENTORY-->
<page string="CURRENT INVENTORY">
<field name="customer_order_lines2"
attrs="{'readonly':['|',('is_custodian','=', True),('is_o2m','=', False)]}"
context="{'default_is_deposit_related': True,'group_by':'products'}"
groups="amgl.group_amark_admins,amgl.group_amark_vault,amgl.group_amark_custodian,amgl.group_amark_sub_admins"
domain="[('state','=','completed')]" default_order='state desc'
widget="one2many_list">
<h4 style="float:right;">
<field name="total_received_quantity"/>
</h4>
<tree open="false" editable="bottom"
groups="amgl.group_amark_admins,amgl.group_amark_vault,amgl.group_amark_custodian,amgl.group_amark_sub_admins">
<field name="is_deposit_related" invisible="1"/>
<field name="is_vault_edit" invisible="1"/>
<field name="is_admin" invisible="1"/>
<field style="color:red !important;" name="products" attrs="{'readonly':[('is_vault_edit','=', True)]}"/>
<field name="commodity"/>
<field name="total_received_quantity"
attrs="{'readonly':[('is_vault_edit','=', True)]}" class="oe_edit_only"
col_border="1" string="Received"/>
<field name="temp_received_weight" class="oe_edit_only" col_border="1"/>
<field name="date_received" attrs="{'readonly':[('is_vault_edit','=', True)]}"
class="oe_edit_only" col_border="1"/>
<field name="state" invisible="1"/>
<field name="notes_boolean" invisible="1"/>
<button attrs="{'invisible':[('notes_boolean','=', False)]}" type="object" name="add_notes" class="btn btn-primary btn-sm o_list_button_add">
<i class="fa-lg fa-pencil-square"></i>
</button>
<button attrs="{'invisible':[('notes_boolean','=', True)]}" type="object" name="add_notes" class="btn btn-default">
<i class="fa-lg fa-pencil-square"></i>
</button>
<!--<button colors="red: notes_boolean is True" name="add_notes" type="object"-->
<!--string="Add Notes" icon="fa-lg fa-pencil-square" class="btn btn-primary btn-sm o_list_button_addhlight"/>-->
</tree>
</field>
</page>
</notebook>
</sheet>
</form>
</field>
</record>