تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
31284 أدوات العرض

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.

 

الصورة الرمزية
إهمال
الكاتب أفضل إجابة

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.

الصورة الرمزية
إهمال
أفضل إجابة

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

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
0
مارس 15
4569
1
فبراير 24
11413
2
يوليو 15
15098
1
مارس 15
5047
1
مارس 15
5086