odoo - how to define a class that inherit from an class which inherit from another

Viewed 46

There are classes A and B.
B inherits from class A.

Now I wanna create class C and inherit from class B, but I don't want to give class B _name, as it's from odoo original code. I don't want to modify it. How should I define class C now?

class A (models.Model):
   _name="a"

class B(models.Model):
  _inherit = "a"

class C(models.Model):
    ?

1 Answers

In Odoo, when you inherit from any class all the functionalities and attributes will be inherited. So in your case.

"class A" is the base model "class B" is inherited from "class A" then you can simply write:

class C(models.Model): _inherit='a'

It will include all the attributes and functionalities from class A and class B.

Related