Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Inheritance and extension in odoo9

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 285
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: