Create a new model in Odoo without a table in the database

There are situations when you want to have a model that will not be represented by a table in the database. By default, Odoo creates a table for every model. But, if you want to change that behaviour, you can set the _auto attribute in the model to False and a DB table will not be created for your model.

For example, if you want to create a new PartnerContact model for which you don’t want a table in the database to be created, the code should look like:

from openerp import models

class PartnerContact(models.Model):
    _name = 'partner.contact'
    _auto = False

 

Leave a Reply

Your email address will not be published.