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

Takes a database id or a list of ids and returns a recordset.

Hi all , this is the meaning of function browse. I try to print data using function browse but why it always print record in order ?
Ex:

print(self.browser([2, 5, 7]))

but result always 2 , 5, 7 if it is set it should not in order 


Thank in advances



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

Hello @sambath,

Browse method is used to get record set from database id or list of ids. 

Here in example, you are trying to get record set for id = [2,5,7]

(I assume here self means sale.order)

orders = self.browse([2,5,7])

In orders now you have record set of order [2,5,7] and you need to execute for loop to print data.

Like,

for order in orders:

print order.name #Here ypu can print any field from Sale order.

Let me know if you have any query.

If you are satisfied with my answer then can you please mark this as resolved.

Regards,




Email: odoo@aktivsoftware.com

Skype: kalpeshmaheshwari

   

Ảnh đại diện
Huỷ bỏ