Hi All,
I am trying to defined the invisible attribute of a button based on a field that is a many2many field which is supposed to have a list of ids; however, I am not quite sure how I can access this many2many field in xml.
Below is the code:
<record id="sale_order_approver_condition_inherited" model="ir.ui.view">
<field name="name">sale_order_approver_condition_inherited</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//button[@name='print_quotation']" position="after">
<field name="id" invisible="1"/>
<field name="q_validators" invisible="1"/>
<field name="q_validators_pending" invisible="1"/>
<button string="Approve Quotation" type="object" name="validate_quotation" class="btn-primary"
context="{'sale_order_id':context.get('id'),'q_validators':context.get('q_validators'),
'q_validators_pending':context.get('q_validators_pending')}"
attrs="{'invisible':[('state','not in',['q_validate'])]
}" />
</xpath>
</field>
q_validators_pending is the many2many field that I want my condition to access, and the bold line is where I would like to insert the condition.
What I want to achieve is for example (but I want it in xml):
if uid not in q_validators_pending:
invisible = True