Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
5346 Lượt xem

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?

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 3 15
9726
6
thg 6 17
42133
3
thg 12 15
1367
1
thg 8 22
2807
1
thg 11 15
7319