'Domain for partner_shipping_id showing the child_ids of partner_id - Odoo

I would like to ovewrite partner_shipping_id field in sale.order to only display contacs from res.partner that match partner_id. Currently shows all existing contacts, so I would like to change this behavior.

This is what I tried:

 partner_shipping_id = fields.Many2one(
        'res.partner', 
        string='Delivery Address', 
        readonly=True, 
        required=True,
        states={
            'draft': [('readonly', False)], 
            'sent': [('readonly', False)], 
            'sale': [('readonly', False)]},
        domain="[('child_ids.parent_id','=', partner_id)]"
        # domain=
        # "['|', ('company_id', '=', False), ('company_id', '=', company_id)]",
        )

But this only returns the same selected record in parnter_id field.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source