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

Hello folks,
i have quetion regarding recordset.

i have one2many field with 10 values i need to get last inserted record from the field 
how can we do that in odoo any help will be apreciated and thanks for your time.

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

self.'one2manyfield'[-1]

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

Hi,

Try this code:# Assuming 'order' is an instance of your model and 'order_line_ids' is a One2many or Many2many field
last_inserted_order_line = order.order_line_ids[-1]


Hope it helps

Ảnh đại diện
Huỷ bỏ
Tác giả

it's work! thanks for your repely:)

Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 7 22
2299
0
thg 6 22
2425
2
thg 10 21
6537
3
thg 5 23
3433
1
thg 5 23
4282