It is currently Sat Feb 11, 2012 9:04 pm

All times are UTC + 2 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: extract data in list
PostPosted: Tue Mar 09, 2010 10:29 am 
Offline

Joined: Wed Jan 20, 2010 1:53 pm
Posts: 16
Hello,

I want extract the mobile number in a partner.
I made this method :
Quote:
service = netsvc.LocalService("object_proxy")
res_ids = service.execute(cr.dbname, uid, 'res.partner.address', 'search', [('partner_id','in',data['ids']),('type','=','default')])
res = service.execute(cr.dbname, uid, 'res.partner.address', 'read', res_ids, ['mobile'])


I print the answer 'res' in a txt file and it give :

Quote:
[{'mobile': u'+3212345678', 'id': 6}]


Now I want juste the number so '+3212345678'.
I think there is a method to retrieve and I don't want split the string because a mobile can have many form(+ or not, more numbers, etc.) so I would like a generic method.

Thanks in advance !


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 09, 2010 11:21 am 
Offline

Joined: Tue May 05, 2009 8:54 am
Posts: 15
Hi Aioros
you can use str.
like:
Quote:
res = [{'mobile': u'+3212345678', 'id': 6}]
str(res[0]['mobile'])

you will get output : +3212345678
Hope you got your solution
Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 09, 2010 11:32 am 
Offline

Joined: Wed Jan 20, 2010 1:53 pm
Posts: 16
yes it's exactlly what I want, thanks a lot for your quick answer !


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