This is my .py
@api.depends('product_id')
def get_sales_divisi(self):
for line in self:
if line.product_id.divisi_update:
line.sales_divisi_id = line.product_id.divisi_update.id
elif line.product_id.divisi_ids:
line.sales_divisi_id = line.product_id.divisi_ids.ids[0]
this is my .xml
<button name="action_approve" string="Approve Checker" type="object" attrs="{'invisible':['|',('sales_divisi_id', '=', '2'),('sales_divisi_id', 'in', ('VET'))]}" groups="ts_addons_tbk.group_tbk_checker" />
I'm tying to make the button invisible when the sales_divisi_id is Vet but it doesn't work. Any advice please? Thank you
Assuming
sales_divisi_idis a relation,inoperator will query byidornamefield. Furthermore, in order to use fields in queries inside your views, you need to define them first.For example:
action_approvebutton will show only ifsales_divisi_idis related to a record havingid1 or 2.