Q1. I would like to list only those Incoming Shipments that belong to POs with a certain value in one of the fields of PO. E.g. I have a field called po_type with options, say, 'A', 'B', 'C' etc.
I would like to list only those incoming shipments that belong to POs of po_type = 'A'.
What would the domain filter look like in this case?
EDIT: found the method. It's ('purchase_id.po_type','=','A').
Q2. I have inherited purchase_order_line and added a couple of columns to it. I have added these columns to the order_line grid inside purchase_order form using an xpath.
I now want to set its invisible attribute to true based on the po_type value in its parent. When I use the standard way,
attrs="{'invisible':[('po_type','=','A')]}"
it is unable to find po_type, as it obviously is not a line item property but instead belongs to its parent.
How do I make the columns invisible based on a parent's column value?
EDIT: some code:
<record id="purchase_order_A_form" model="ir.ui.view">
<field name="name">purchase_order_A_form</field>
<field name="model">purchase.order</field>
<field name="type">form</field>
<field name="inherit_id" ref="purchase.purchase_order_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='order_line']/tree//field[@name='name']" position="after">
<field name="my_brand" attrs="{'invisible':[('parent.po_type','!=','A')]}"/>
</xpath>
<field name="pricelist_id" select="2" position="after">
<field name="po_type"/>
</field>
</field>
</record>
Thanks