Se rendre au contenu
Menu
Cette question a été signalée
2 Réponses
2116 Vues

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
Ignorer
Meilleure réponse

self.'one2manyfield'[-1]

Avatar
Ignorer
Meilleure réponse

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

it's work! thanks for your repely:)

Publications associées Réponses Vues Activité
2
juil. 22
2270
0
juin 22
2381
2
oct. 21
6431
3
mai 23
3351
1
mai 23
4207