Skip to Content
Menu
This question has been flagged
1 Reply
3049 Views

Hello, 

what's the difference between models.model and model.BaseModel ?

and where can i find a documentation that explains in details these differences if there is

Avatar
Discard
Best Answer

Hi,
The BaseModel is the base class for Odoo models. Odoo models are created by inheriting one of the following:1. class:`Model` for regular database-persisted models.
2. class:`TransientModel` for temporary data, stored in the database but
        automatically vacuumed every so often.3. class:`AbstractModel` for abstract superclasses meant to be shared by
        multiple inheriting models.
    The system automatically instantiates every model once per database. Those
    instances represent the available models on each database, and depend on
    which modules are installed on that database. The actual class of each
    instance is built from the Python classes that create and inherit from the
    corresponding model.
    Every model instance is a "recordset", i.e., an ordered collection of
    records of the model. Recordsets are returned by methods like
    :meth:`~.browse`, :meth:`~.search`, or field accesses. Records have no
    explicit representation: a record is represented as a recordset of one
    record.
    To create a class that should not be instantiated,
    the :attr:`~odoo.models.BaseModel._register` attribute may be set to False.
You can read more about models in this article. 

https://www.cybrosys.com/odoo/odoo-books/odoo-15-development/ch3/adding-models/#:~:text=In%20Odoo%2C%20A%20model%20is,with%20a%20single%20database%20table

Hope it helps

Avatar
Discard