Skip to Content
Menú
This question has been flagged
2 Respostes
2122 Vistes

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.

Avatar
Descartar
Best Answer

self.'one2manyfield'[-1]

Avatar
Descartar
Best Answer

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

Avatar
Descartar
Autor

it's work! thanks for your repely:)

Related Posts Respostes Vistes Activitat
2
de jul. 22
2275
0
de juny 22
2383
2
d’oct. 21
6433
3
de maig 23
3356
1
de maig 23
4214