Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
2125 Weergaven

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
Annuleer
Beste antwoord

self.'one2manyfield'[-1]

Avatar
Annuleer
Beste antwoord

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
Annuleer
Auteur

it's work! thanks for your repely:)

Gerelateerde posts Antwoorden Weergaven Activiteit
2
jul. 22
2277
0
jun. 22
2384
2
okt. 21
6435
3
mei 23
3358
1
mei 23
4217