Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Whats the difference between inherit and inherits?

By
René Schuster
on 5/15/14, 6:06 AM 2,179 views

In model inheritance, you can define values for _inherit (parent model name) and _inherits (dictionary with parent model and parent relation field).

What is the difference? Especially regarding the ORM.

Regards.

 

This question has been included in the official documentation.
3

René Schuster

--René Schuster--
1560
| 5 5 8
Weinheim, Germany
--René Schuster--

Challenge Everything!

René Schuster
On 6/26/14, 9:44 AM

The Technical Memento contains a great visualisation of the different inheritance methods:

https://www.odoo.com/files/memento/OpenERP_Technical_Memento_latest.pdf

Class inheritance, prototype inheritance and delegation.

This question has been included in the official documentation.
0
Eduardo BP
On 5/11/15, 2:42 PM

But the Technical Memento that @René shows in the above post doesn't match the explanation of the inheriting mechanism from the official Odoo documentation (https://www.odoo.com/documentation/8.0/reference/orm.html#inheritance-and-extension).

This documentation says that the classical inheritance is like the following example:

class Inheritance0(models.Model):
_name = 'inheritance.0'
name = fields.Char()

def call(self):http://i.imgur.com/lOgNgMI.png
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")

But this above example corresponds to the prototype inheritance in the technical memento from the above post.

http://i.imgur.com/lOgNgMI.png

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 5/15/14, 6:06 AM
Seen: 2179 times
Last updated: 5/11/15, 2:42 PM