There are cases when is needed to have a model that will not be represented by a table in the database. By default, Odoo creates a table for every Model
and TransientModel
, but, there is option to change that by setting up the attribute _auto
to False
For example, If we want to create a new model PartnerContact
that will have the base fields and methods for our PartnerCompany
and PartnerPerson
models the base definition of the model should look like:
from odoo import models
class PartnerContact(models.Model): _name = 'partner.contact'
_description = 'Partner Contact'
_auto = False
Another way of doing this is by inheriting the class AbstractModel
which by default has the attribute _auto
set to False
from odoo import models
class PartnerContact(models.AbstractModel): _name = 'partner.contact'
_description = 'Partner Contact'