Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
2154 มุมมอง

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.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

self.'one2manyfield'[-1]

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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

อวตาร
ละทิ้ง
ผู้เขียน

it's work! thanks for your repely:)

Related Posts ตอบกลับ มุมมอง กิจกรรม
2
ก.ค. 22
2292
0
มิ.ย. 22
2411
2
ต.ค. 21
6494
3
พ.ค. 23
3397
Group by on related field แก้ไขแล้ว
1
พ.ค. 23
4256