Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
1 Vastaa
5360 Näkymät

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?

Avatar
Hylkää
Tekijä Paras vastaus

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'] )

Avatar
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
2
maalisk. 15
9737
6
kesäk. 17
42142
3
jouluk. 15
1367
1
elok. 22
2814
1
marrask. 15
7326