ir.model

Provides information about Odoo models via its various fields

name

a human-readable description of the model

model

the name of each model in the system

state

whether the model was generated in Python code (base) or by creating an ir.model record (manual)

field_id

list of the model’s fields through a One2many to ir.model.fields

view_ids

One2many to the Views defined for the model

access_ids

One2many relation to the Access Control set on the model

Note

ir.model can be used to:

  • query the system for installed models (as a precondition to operations on the model or to explore the system’s content)

  • get information about a specific model (generally by listing the fields associated with it)

  • create new models dynamically over REST API

Warning

  • custom model names must start with x_

  • the state must be provided and manual, otherwise, the model will not be loaded

  • it is not possible to add new methods to a custom model, only fields

Example

Create x_custom_model model record in ir.model object using Create Records API endpoint.

Request:

JSON Response:

XML Response:

  1. Inspect a model x_custom_model’s fields using the Listing Record Fields API endpoint.

Request:

JSON Response:

Note

a custom model will initially contain only the “built-in” fields available on all models

XML Response:

Last updated