env = env # noqa mo49 = env['mrp.production'].browse(49) print('id=49:', mo49.name, 'state=', mo49.state, 'company=', mo49.company_id.id) mo47 = env['mrp.production'].browse(47) print('id=47:', mo47.name, 'state=', mo47.state, 'company=', mo47.company_id.id) res = env['mrp.production'].search([('state', '=', 'done')], order='id desc', limit=3) for m in res: print('got:', m.id, m.name, m.state)