Development Book V17: Model Attributes

These are the features that are defined when creating a new model or when using an existing model. Let us see the model attributes in Odoo

_auto = false - Override init() to build the database table whether we establish a new database table that is set to False. It is set to True by default for models and Transient models, and False for Abstract models.

_log_access - Whether the ORM should generate and update the Access Log Files automatically. Defaults to the value specified for _auto.

_table = None - If _auto, it is the model's SQL table name.

_sequence = None - A SQL sequence is used for an ID field.

_sql_constraints = [] - SQL constraints [(name, sql_def, message)].

_register = False - Registry visibility is set to false by default.

_abstract = True - To determine whether the model is abstract model.

_transient = True - To determine whether the model is Transient model.

_name = None - model name.

_inherit = () - we use the inherited attribute when we want to use a model that is already in the database.

_description = None - The models' informal names.

_inherits = {} - dictionary {‘parent_model’: ‘m2o_field’} mapping the _name of the parent objects to the names of the corresponding foreign key fields to use.

_rec_name = None - Records are labelled with this term. It is the record's name by default.

_order = ‘id’ - The search results' default order field.

_check_company_auto = False - On write and create, call _check_company to ensure companies consistency on the relational fields having check_company=True as an attribute.

_parent_name = ‘parent_id’ - The many2one field is used as the parent field.

_parent_store = false - If set to True, the parent_path field is computed.

_date_name = 'Date' - used for the calendar view by default.

_fold_name = 'fold' - used in kanban views to determine folded groups.

whatsapp
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message