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

Hello,


When i create a new sale order, the shipping address is by default one of the shipping address of the customer!

But i need to have by default, the address of the customer (fields street, street2, zip, city,...) without have to create a new shipping address for that


When i create a sale order for a customer without any shipping address, its address (street, street2,...) is automaticaly selected.

I want the same thing even if shipping address exists!


Do you know how i can do that ?


Thank you by advance

Avatar
Discard
Best Answer

first of all, add a context to your partner_id field.

let's say, the context added is : 'update_shipping_add': True

Then inherit function: address_get

def address_get(self, adr_pref=None):
   res = super(ResPartner, self).address_get(adr_pref)
   if  self._context.get('update_shipping_add', False):
       res['delivery'] = res['contact']
   return res

Hope it helps. 

Upvote if it does.

Regards.

Avatar
Discard
Author

Hi Ibrahim,

Sorry i forgot to answer.

I found a similar way to do that also i think your solution works.

Thank you