Skip to Content
Menu
This question has been flagged
1 Reply
1283 Views

Goodnight,

I want to be able to show the delivery addresses that a partner has. I am trying with:

#the user must select the main partner

    partner_direccion_partida_id = fields.Many2one("res.partner")
#main partner addresses.
    direccion_partida_id = fields.Many2one("res.partner" ,states={'validado': [('readonly',True)]})


in view:

      <field name="direccion_partida_id" 
                                        string="Dirección de Partida"                                
                                        context="{
                                                    'ubigeo_search': True,
                                                    'form_view_ref' : 'efact.view_form_destinatario_res_partner',
                                                    'default_country_id':173,
                                                    'default_type':'delivery',
                                                    'default_parent_id':partner_direccion_partida_id
                                                }"
                                        domain="[('parent_id','=',partner_direccion_partida_id),
                                                    ('parent_id','!=',False),
                                                    ('type','in',['delivery '])]"/>

but it shows me the main partner and not the partner (address as son)

please appreciate your help.

odoo12

Avatar
Discard
Best Answer

Hello, 

You have added extra space while passing "delivery" type inside the domain. 

Update the below code


<field name="direccion_partida_id" 

                                        string="Dirección de Partida"                                

                                        context="{

                                                    'ubigeo_search': True,

                                                    'form_view_ref' : 'efact.view_form_destinatario_res_partner',

                                                    'default_country_id':173,

                                                    'default_type':'delivery',

                                                    'default_parent_id':partner_direccion_partida_id

                                                }"

                                        domain="[('parent_id','=',partner_direccion_partida_id),

                                                    ('parent_id','!=',False),

                                                    ('type','in',['delivery'])]"/>

Thanks

Anisha Bahukhandi

Technical Content Writer

Avatar
Discard