2
.. i18n: Inheritance by Delegation - _inherits
3
.. i18n: =====================================
6
Inheritance by Delegation - _inherits
7
=====================================
9
.. i18n: **Syntax :** ::
11
.. i18n: class tiny_object(osv.osv)
12
.. i18n: _name = 'tiny.object'
13
.. i18n: _table = 'tiny_object'
14
.. i18n: _inherits = { 'tiny.object'_1_ : name_col'_1_',
15
.. i18n: 'tiny.object'_2_ : name_col'_2_', ...,
16
.. i18n: 'tiny.object'_n_ : name_col'_n_' }
22
class tiny_object(osv.osv)
24
_table = 'tiny_object'
25
_inherits = { 'tiny.object'_1_ : name_col'_1_',
26
'tiny.object'_2_ : name_col'_2_', ...,
27
'tiny.object'_n_ : name_col'_n_' }
30
.. i18n: The object 'tiny.object' inherits from all the columns and all the methods from the n objects 'tiny.object'_1_, ..., 'tiny.object'_n_.
33
The object 'tiny.object' inherits from all the columns and all the methods from the n objects 'tiny.object'_1_, ..., 'tiny.object'_n_.
35
.. i18n: To inherit from multiple tables, the technique consists in adding one column to the table tiny_object per inherited object. This column will store a foreign key (an id from another table). The values *name_col'_1_' name_col'_2_' ... name_col'_n_'* are of type string and determine the title of the columns in which the foreign keys from 'tiny.object'_1_, ..., 'tiny.object'_n_ are stored.
38
To inherit from multiple tables, the technique consists in adding one column to the table tiny_object per inherited object. This column will store a foreign key (an id from another table). The values *name_col'_1_' name_col'_2_' ... name_col'_n_'* are of type string and determine the title of the columns in which the foreign keys from 'tiny.object'_1_, ..., 'tiny.object'_n_ are stored.
40
.. i18n: This inheritance mechanism is usually called " *instance inheritance* " or " *value inheritance* ". A resource (instance) has the VALUES of its parents.
43
This inheritance mechanism is usually called " *instance inheritance* " or " *value inheritance* ". A resource (instance) has the VALUES of its parents.