I would like to filter the available partner selection for 'Customer' when creating an invoice in Odoo. Specifically, I'd like to limit the partner contact records to those of type 'invoice address', i.e. a domain on res_partner of [('type','=','invoice')].
Can anyone point me in the right direction please?
I can see that res_partner._name_search will accept Args, and by the look of the code in models.py the Args could be the required domain, becoming a where clause. However, I can't see how to specify this in the xml (or anywhere else). The standard xml for the Customer drop-down is
<field name="partner_id" widget="res_partner_many2one" context="{'res_partner_search_mode': 'customer', 'show_address': 1, 'show_vat': True}" options='{"always_reload": True}'/>
res_partner_search_mode looked kind of promising, but seems to only be used in setting up customer_rank, so no help here. Maybe just override _name_search to filter the records?? I'd be glad of any help. Thanks!