redpill
redpill

Reputation: 87

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

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):
    ?

Upvotes: 2

Views: 160

Answers (1)

Krutarth Patel
Krutarth Patel

Reputation: 56

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.

Upvotes: 3

Related Questions