Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
2120 Vistas

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
Mejor respuesta

self.'one2manyfield'[-1]

Avatar
Descartar
Mejor respuesta

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:)

Publicaciones relacionadas Respuestas Vistas Actividad
2
jul 22
2275
0
jun 22
2383
2
oct 21
6431
3
may 23
3354
1
may 23
4211