Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


override create method

Abdul wahid
on 8/1/15, 1:47 AM 1,496 views

how to override the create method for a model in new api.

i have two models



second model is for the calender view. the 'person_travel'  creates records of  travel details with date.

what i need is , when a user creates a travel record  with a particular date i need that record to be displayed in the calender view with same date....how to do it??????

my plan is to override the create method in 'person_travel' model...how to achieve it??

Burhan Vakharia
On 1/4/16, 9:09 AM

Learn Overriding Create Method in Odoo 8 with Example - Odoo Technical




| 5 4 8
Kochi, India
ODOO technical and functional

        I like learning new thing, especially technical thing. I am a quick learner, I can learn technical things very fast. I have good logical skill,  I have immense interest in programming.

e-mail id : baijuks@hotmail.com

On 8/15/15, 1:39 AM

Hi Abdul,

When you are overriding ORM Methods (write, create ...), if you don't want to call the super function(sometimes it will raise exception if you call super after your modification), you can use like this:-

To eliminate need of calling super method, you can use like this:-

instead of this -> super(stock_move, self).write(cr, uid, ids, vals, context=context)

you can give-> osv.osv.write(self, cr, uid, ids, vals, context=context)

This will call directly write function of ORM...

Hope this helps....

On 8/3/15, 3:27 AM


For override create method you need to override this method in 'person_travel' model.

class person_travel(osv.osv):

  _descriptin = "Person Travel"

_name = "person.travel"

  _columns = {}

_defaults = {}

def create(self,cr,uid,vals,context=None)

    Put your code here.

   return super(person_travel, self).create(cr, uid, vals, context=context)

Hope this will help you.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


Asked: 8/1/15, 1:47 AM
Seen: 1496 times
Last updated: 1/4/16, 9:09 AM