Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to use Classical inheritance in openERP/Odoo ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 317
    Comment on it

    When using the _inherit and _name attributes together, Odoo creates a new model using the existing one as a base. The new model gets all the fields, methods and meta-information from its base. For example you can take idea from below code-

    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: