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

Goodnight,

Where is the customer delivery address table, and how can I reference it from odoo (python)

and if I had several, how could I refer to each one.

I would appreciate your help.

thanks.

Avatar
Discard
Best Answer

Hi,  Gianca


In Odoo customer and it's invoice/delivery address are managed by the same table "res.partner".

You can filter delivery addresses by it's type "delivery" in Odoo. You can find the list of partners included addresses from below path,

  • Order -> Customers  or  Contacts 

  • Then remove the filter "customers".

  • And from filters select "Address Type" field and "Delivery Address" in value.

  • Then you will be able to see the list of add delivery addresses.

Feel free to ask in case you have any doubt related to the above points.


Thanks,.
Ashish Singh (Team Lead)
Webkul Software Private Limited
Avatar
Discard
Author

Hi, thanks for the reply but I was waiting for the bbdd field and the reference similar to env []. xxx to get it from a custom report. Thank you for your kind response.

Author

And if you have multiple contacts and multiple delivery addresses, how do I differentiate one from the other?

Author

Sorry for not specifying correctly, I was waiting for a response with Pyton code. thanks.

Hi, Gianca

Thanks for clarifying your question.

For example I have multiple contacts/addresses then in order fetch list of addresses/contacts then you need to follow below code,

partner_id = 5

partnerObj = self.env['res.partner'].browse(partner_id)

# inside res.partner there is a field "child_ids" which will give you list of associated contacts/addresses,

childObjs = partnerObj.child_ids

You can differentiate contacts using "type" fields,

# Get list of contacts

contactObjs = childObjs.filtered(lambda c: c.type == 'contact')

# Get list of delivery address

contactObjs = childObjs.filtered(lambda c: c.type == 'delivery')

# Get list of billing address

contactObjs = childObjs.filtered(lambda c: c.type == 'invoice')

# Get list of other address

contactObjs = childObjs.filtered(lambda c: c.type == 'other')

# Get list of private address

contactObjs = childObjs.filtered(lambda c: c.type == 'private')

Hope above points are clear to you.

Thanks,

Ashish Singh

Author

Thank you very much, the explanation was excellent.

Hi, Gianca

Thanks for your appreciation.

Now if my solution helps you to fix your query and If you liked my assistance then I would really appreciate if you can take out a few minutes out of your busy schedule and put a google review for us here -

https://www.google.com/search?q=webkul&oq=webkul+&aqs=chrome..69i57j69i60l3j0l2.4182j0j7&sourceid=chrome&ie=UTF-8#lrd=0x390ce561c5555555:0xcfb40ae166ce6c21,1

Thanks

Ashish Singh