Odoo Help


How to inherit the same model twice the same module

Pieter Paulussen
on 11/9/16, 6:22 AM 633 views

Say I have a python class from odoo that inherits 'res.partner' to add a number of fields to the model.

To improve overall code clearness I want to separate that file into two pieces. So in my module I will have two python files that both inherit res.partner. However, when I inherit res.partner again I get an error saying that there is a column missing (the first field in the second python file). 

How can I inherit from the same model twice within the same custom module?

Pieter Paulussen
On 11/9/16, 7:06 AM

Already solved my own problem: 

It is possible to inherit the same base model in the same custom module. Just make sure your xml import (If you split those up as well) are in the correct order.


Techno-Functional Associate with 7+ years of experience in Odoo (formerly known as OpenERP).

On 11/10/16, 1:19 AM

You can inherit the same base model twice or thrice or any number of times, just ensure the class name is different from other, that way inheritance will not be overlapped..

For example

class ResPartner(models.Model):
_inherit = 'res.partner'

class ResPartner2(models.Model):
    _inherit = 'res.partner'

class ResPartner3(models.Model): _inherit = 'res.partner'

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 11/9/16, 6:22 AM
Seen: 633 times
Last updated: 11/10/16, 1:19 AM