Odoo Help

0

how to convert char results into index (result index)

By
Lakay lakay
on 9/25/14, 12:08 AM 766 views

Hi, im having a problem in here:

search_result0=self.pool.get('res.users').search(cr,uid,[('id','=',uid)],context=context)  

                partnerid=self.pool.get('res.users').read(cr,uid,search_result0,['partner_id'])

                for record in partnerid:
                     internalno=record['partner_id']

                self.write(cr,uid,ids,{'storage':internalno})

 

the return value of partnerid when i print it on a text box in the odoo is " (3, u'Administrator') "  the 3 there is the partner id im looking for, how can i cast the result into an address location   i want some like this (output)    ->>  [3]  because i will use this on later codes

 

0

Hello,

Here "partner_id" is the many2one field so, it is read the data like "(3,u'Administrator')". If you just want the 3 from this just partner ID then you have to write like below.

                 for record in partnerid:
                     internalno=record['partner_id'][0]

Here record['partner_id'][0] will return the 3.

thank you chirag! it works perfectly.

Lakay lakay
on 9/25/14, 1:31 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 9/25/14, 12:08 AM
Seen: 766 times
Last updated: 3/16/15, 8:10 AM