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.


how to override an inherited method?

on 4/15/14, 7:02 PM 3,570 views

Hello, I am trying to override a create method for the crm.leads model, but cant seem to get the overridden method to be called instead of the original.

Can someone tell me how to override another method from an inherited module?

Rafael Reuber
On 4/15/14, 10:21 PM
  1. Have you imported your python module on __init__,py where your custom class are declared?
  2. Have you called your class after the class declaration?
  3. Have you imported the crm module on __openerp__.py file?


my_module.py file:

 class my_crm_lead(base_stage, format_address, osv.osv):
    def create(self, cr, uid, vals, context=None):
         if context is None:
            context = {}
         create_context = dict(context)
         return super(crm_lead, self).create(cr, uid, vals, context=create_context)

my_crm_lead() #call the class it's required

__init__.py file:

import my_module

__openerp__.py file:

   'name': 'My CRM',
   'version': '1.0',
   'category': '...',
   'depends': ['crm'],
   'installable': True,

Hello, and thanks for your help. I forgot to import the class file in the __init__.py file. Once I did that then it worked

on 4/16/14, 1:22 PM

Hello Eric. Please, could you mark my answer as the correct?

Rafael Reuber
on 4/16/14, 2:16 PM
Ricardo Martins
On 4/15/14, 10:26 PM

You need to add the original module on openerp "Depends" List file. In that case i think is the crm.

Hope it helps.

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

4 follower(s)


Asked: 4/15/14, 7:02 PM
Seen: 3570 times
Last updated: 3/16/15, 8:10 AM