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.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
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.
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.
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.
And if you have multiple contacts and multiple delivery addresses, how do I differentiate one from the other?
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
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 -
Thanks
Ashish Singh
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up