Change Invoice list code if records: action = env['ir.actions.act_window'].for_xml_id('account_invoice_change', 'action_view_account_invoice_change') action['context'] = { 'active_model': model._name, 'active_ids': records.ids, }