I want to get the current partner's id in my stock.picking view. I foud something like this
<field
name="myId"
domain="[('partner_id','=',id)]"
/>
but it's wrong.Is it even possible to have the current partner's id?
The domain
is used to apply filters when displaying existing records for selection.
To hide a field based on a record values you need to use attrs
attribute and use the invisible
value.
It is a mapping of attributes to domains, domains are evaluated in the context of the current row’s record, if True the corresponding attribute is set on the cell.
Example:
attrs="{'invisible': [('interval_type', '=', 'days')]}"
You can define a computed field to show the partner id field. Try the following code:
@api.depends('partner_id')
def get_partner_id(self):
for record in self:
if record.partner_id:
record.raw_partner_id = record.partner_id.id
raw_partner_id = fields.Integer(compute='get_partner_id')
To show the stock.picking
ID, you just need to add <field name="id"
/> in the view definition.