Is there any way to hide some fields in purchase order line based on some conditions/value of their parent (order_id). I've tried this way:
<field name="price_subtotal" attrs="{'invisible': [('order_id.currency_id.name', '=', 'IDR')]}"/>
But unfortunately, this one only works with Odoo v7 and lower. I use v16 by the way. Thanks in advance.
For invisibility on parent conditions you can use column_invisible
with parent
as the parent of the relation.
But following example won't work, because you can only use one level of field depth on the parent.
<field name="price_subtotal"
attrs="{'column_invisible': [('parent.currency_id.name', '=', 'IDR')]}" />
You can use currency_id
(relation field) on purchase.order.line
instead, because it is in the view anyways. But instead of using the name, go for the id in form of the external id:
<field name="price_subtotal"
attrs="{'invisible': [('currency_id', '=', %(base.IDR)d)]}" />