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 change inheritance order of models?

on 2/4/15, 8:22 AM 545 views

Is it possible to define the inheritance order of models without changing dependencies or renaming of modules? Other question: How is the order calculated?


# module A
class test_module(Model):
    _name = 'test.module'

    def test_function(self, par):

# module B
class test_module(Model):
    _inherit = 'test.module'

    def test_function(self, par):

# module C
class test_module(Model):
    _inherit = 'test.module'

    def test_function(self, par):

Module B depends on A and Module C depends also on A. When using this definition then "C" is printed but I want "B" printed. I don't want to set C as a dependency of B and I don't want to change

This is just a hunch that I have not tested myself. Uninstall both modules B and C, then install C first before B. AFAIK, there is no deterministic way to sequence dependency in the case like this. You need to tweak the way BaseModel do inheritance.

on 2/4/15, 10:02 AM

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

5 follower(s)


Asked: 2/4/15, 8:22 AM
Seen: 545 times
Last updated: 3/29/16, 2:09 AM