跳至内容
菜单
此问题已终结
2 回复
2123 查看

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.

形象
丢弃
最佳答案

self.'one2manyfield'[-1]

形象
丢弃
最佳答案

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

形象
丢弃
编写者

it's work! thanks for your repely:)

相关帖文 回复 查看 活动
2
7月 22
2277
0
6月 22
2384
2
10月 21
6435
3
5月 23
3358
1
5月 23
4216