Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
2 Vastaukset
2140 Näkymät

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
Hylkää
Paras vastaus

self.'one2manyfield'[-1]

Avatar
Hylkää
Paras vastaus

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
Hylkää
Tekijä

it's work! thanks for your repely:)

Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
2
heinäk. 22
2284
0
kesäk. 22
2402
2
lokak. 21
6460
3
toukok. 23
3381
1
toukok. 23
4239