Inheritance and extension in odoo9 is used to set one page to another page and Odoo provides three different mechanisms to extend models in a modular way.
1. creating a new model from an existing one, adding new information to the copy but leaving the original module
2. extending models defined in other modules in-place, replacing the previous version
3. delegating some of the model's fields to records it contains
For example code is given below.
class Inheritance0(models.Model):
_name = 'inheritance.0'
name = fields.Char()
def call(self):
return self.check("model 0")
def check(self, s):
return "This is {} record {}".format(s, self.name)
class Inheritance1(models.Model):
_name = 'inheritance.1'
_inherit = 'inheritance.0'
def call(self):
return self.check("model 1")
0 Comment(s)