Odoo Help

Welcome!

This community 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.

0

getting string from OSV object

By
David Brilliant
on 9/27/13, 5:47 PM 726 views

So, I'm trying get the value of a field as a string, and all I get when I cast the self.pool.get method to a string is a big fat "None"

Here's my code:

ccNum = str( self.pool.get('account.voucher').browse(cr,uid,'card_number',context=None)[0] )

Can I not cast this to a string? If not, then what do I need to do to get the value out as a string instead of an object?

0
David Brilliant
On 9/27/13, 6:20 PM

Fixed it!

Was using the wrong function. Here's the right way:

ccNum = str( self.pool.get('account.voucher').read(cr,uid,ids,['card_number'],context=None)[0]['card_number'] )

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 9/27/13, 5:47 PM
Seen: 726 times
Last updated: 3/16/15, 8:10 AM