Inheritance by Delegation - _inherits
Syntax ::
class tiny_object(osv.osv)
_name = 'tiny.object'
_table = 'tiny_object'
_inherits = {
'tiny.object_a': 'object_a_id',
'tiny.object_b': 'object_b_id',
... ,
'tiny.object_n': 'object_n_id'
}
(...)
对象“tiny.object”继承n个对象“tiny.object_a, …,tiny.object_n”的所有的字段和方法。
为了继承多种表格,每继承一个对象就加一列到表格中。这个列存储继承表格的外键。值‘object_a_id’ ‘object_b_id’ … ‘object_n_id’ 是字符串类型,定义列头,它里面放着存储对象‘tiny.object_a’, …, ‘tiny.object_n’的外键。
This inheritance mechanism is usually called “ instance inheritance “ or “ value inheritance “. A resource (instance) has the VALUES of its parents.