It is currently Tue May 22, 2012 11:24 pm

All times are UTC + 2 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: [SOLVED] Calling "get_city" method from Sale.order
PostPosted: Sun Jun 05, 2011 6:37 pm 
Offline

Joined: Tue Mar 09, 2010 4:08 pm
Posts: 117
Hi

There is a "get_city" method in the res.partner.address object but I don't know how I would call it from the sale.order object.

In the sale.order object, there is an "onchange_partner_id" method which gives me the partner_id and the associated address, but I can't work out what the code would be to call the "get_city" method.

Please help.

Thanks
O.


Last edited by ocset on Mon Jun 06, 2011 1:31 pm, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: Calling "get_city" method from Sale.order
PostPosted: Mon Jun 06, 2011 9:36 am 
Offline

Joined: Wed Jan 27, 2010 6:21 pm
Posts: 797
Location: Auckland, NZ
something like

address_obj = self.pool.get('res.partner.address')
address = (whatever onchange returns as address)
city = address_obj.get_city(cr, uid, address.id, context=context)

If address is already an int then just pass address rather than address.id. Anyway I don't know the function at all but assume it returns a string, so should be all you need.

_________________
Graeme


Top
 Profile  
 
 Post subject: Re: Calling "get_city" method from Sale.order
PostPosted: Mon Jun 06, 2011 10:40 am 
Offline

Joined: Tue Mar 09, 2010 4:08 pm
Posts: 117
Thanks gdaddy - seems so simple.

Funny how when you see the answer, it is obvious :D

Regards
O.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 2 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:

Protected by Anti-Spam ACP