📜  最后一个增值 odoo - 任何代码示例

📅  最后修改于: 2022-03-11 14:56:53.306000             🧑  作者: Mango

代码示例1
last_id = self.env['table.name'].search([], order='id desc')[0].id

search_ids = self.pool.get("res.partner").search(cr, uid, [])
last_id = search_ids and max(search_ids)

cr.execute('select "id" from "table_name" order by "id" desc limit 1')
id_returned = cr.fetchone()

last_id = self.env['table.name'].search([])[-1].id