override create method odoo 8

Greetings everyone, In this blog-post, you will learn how to override create method in Odoo v8.

The create method for a particular model  can be called by clicking the ‘Create’ button in the view of that model.

Here I have overridden the create method of res.users model. You can override the create method of any model in similar way in Odoo 8.

You can override the create method for a particular model by,

class res_users(models.Model):
    _inherit ='res.users'

    def create(self, vals):

        #Write your logic here
        print 'Fields and their values to be created in a dictionary',vals
        res = super(res_users, self).create(vals)

        #Write your logic here

        return res


You need to give the class name in the super method. For eg here:- res_users

Use of Create Method in Odoo:

  • Create method executes an SQL INSERT query on the table / model.
  • ” self ” states the model in which the record will be created.
  • The values of the field  that are going to be written can be found in the vals dictionary, which is the parameter to the method.
  • The values can be extracted form the dictionary and can be checked against a criteria and a Warning can be raised if its fails to do so.
  • The vals dictionary can be modified as per the requirement before calling the super method.


Here is a snapshot form eclipse IDE:-

Overriding Create Method in Odoo 8

Hope you got an insight and understanding of the ORM create method in Odoo 8 and the way of overriding it.

Please Comment below if you have any doubts,

Thank you.


By Burhan Vakharia

Having 6+ years of experience working on Odoo with projects covering several business verticles like Retail industry, Manufacturing, Service, Rental, Education, Medical and many more. I am having experience working on Odoo projects from several countries across the globe.

Leave a Reply

Your email address will not be published. Required fields are marked *

Notice: ob_end_flush(): failed to send buffer of zlib output compression (1) in /home/odootech/public_html/wp-includes/functions.php on line 4759

Notice: ob_end_flush(): failed to send buffer of zlib output compression (1) in /home/odootech/public_html/wp-includes/functions.php on line 4759