Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
2 Antworten
2232 Ansichten

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
Verwerfen
Beste Antwort

self.'one2manyfield'[-1]

Avatar
Verwerfen
Beste Antwort

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
Verwerfen
Autor

it's work! thanks for your repely:)

Verknüpfte Beiträge Antworten Ansichten Aktivität
2
Juli 22
2300
0
Juni 22
2425
2
Okt. 21
6537
3
Mai 23
3434
1
Mai 23
4282