Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
2111 Visualizzazioni

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
Abbandona
Risposta migliore

self.'one2manyfield'[-1]

Avatar
Abbandona
Risposta migliore

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
Abbandona
Autore

it's work! thanks for your repely:)

Post correlati Risposte Visualizzazioni Attività
2
lug 22
2248
0
giu 22
2381
2
ott 21
6422
3
mag 23
3343
1
mag 23
4200