odoo bertambah bernilai terakhir

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


bilalahmed_dev