~xrg/openobject-doc/trunk-xrg

« back to all changes in this revision

Viewing changes to i18n/uk/source/developer/2_6_views_events/views/view_inheritence.rst

  • Committer: TruongSinh Tran
  • Date: 2009-07-17 18:59:45 UTC
  • Revision ID: truongsinh@vipescoserver-20090717185945-ajjp3zso6xh5jddm
[FIX]private issue

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
.. i18n: Inheritance in Views 
 
3
.. i18n: -------------------- 
 
4
 
 
5
Inheritance in Views 
 
6
-------------------- 
 
7
 
 
8
.. i18n: When you create and inherit objects in some custom or specific modules, it is better to inherit (than to replace) from an existing view to add/modify/delete some fields and preserve the others.
 
9
 
 
10
When you create and inherit objects in some custom or specific modules, it is better to inherit (than to replace) from an existing view to add/modify/delete some fields and preserve the others.
 
11
 
 
12
.. i18n: :Example:
 
13
 
 
14
:Example:
 
15
 
 
16
.. i18n: .. code-block:: xml
 
17
.. i18n: 
 
18
.. i18n:        <record model="ir.ui.view" id="view_partner_form">
 
19
.. i18n:            <field name="name">res.partner.form.inherit</field>
 
20
.. i18n:            <field name="model">res.partner</field>
 
21
.. i18n:            <field name="inherit_id" ref="base.view_partner_form"/>
 
22
.. i18n:            <field name="arch" type="xml">
 
23
.. i18n:                 <notebook position="inside">
 
24
.. i18n:                     <page string="Relations">
 
25
.. i18n:                           <field name="relation_ids" colspan="4" nolabel="1"/>
 
26
.. i18n:                     </page>
 
27
.. i18n:                 </notebook>
 
28
.. i18n:            </field>
 
29
.. i18n:        </record>
 
30
 
 
31
.. code-block:: xml
 
32
 
 
33
        <record model="ir.ui.view" id="view_partner_form">
 
34
            <field name="name">res.partner.form.inherit</field>
 
35
            <field name="model">res.partner</field>
 
36
            <field name="inherit_id" ref="base.view_partner_form"/>
 
37
            <field name="arch" type="xml">
 
38
                 <notebook position="inside">
 
39
                     <page string="Relations">
 
40
                           <field name="relation_ids" colspan="4" nolabel="1"/>
 
41
                     </page>
 
42
                 </notebook>
 
43
            </field>
 
44
        </record>
 
45
 
 
46
.. i18n: The inheritance engine will parse the existing view and search for the the root nodes of
 
47
 
 
48
The inheritance engine will parse the existing view and search for the the root nodes of
 
49
 
 
50
.. i18n: .. code-block:: xml
 
51
.. i18n: 
 
52
.. i18n:        <field name="arch" type="xml">
 
53
 
 
54
.. code-block:: xml
 
55
 
 
56
        <field name="arch" type="xml">
 
57
 
 
58
.. i18n: It will append or edit the content of this tag. If this tag has some attributes, it will look for the matching node, including the same attributes (unless position).
 
59
 
 
60
It will append or edit the content of this tag. If this tag has some attributes, it will look for the matching node, including the same attributes (unless position).
 
61
 
 
62
.. i18n: This will add a page to the notebook of the res.partner.form view in the base module.
 
63
 
 
64
This will add a page to the notebook of the res.partner.form view in the base module.
 
65
 
 
66
.. i18n: You can use these values in the position attribute:
 
67
 
 
68
You can use these values in the position attribute:
 
69
 
 
70
.. i18n:     * inside (default): your values will be appended inside this tag
 
71
.. i18n:     * after: add the content after this tag
 
72
.. i18n:     * before: add the content before this tag
 
73
.. i18n:     * replace: replace the content of the tag. 
 
74
 
 
75
    * inside (default): your values will be appended inside this tag
 
76
    * after: add the content after this tag
 
77
    * before: add the content before this tag
 
78
    * replace: replace the content of the tag. 
 
79
 
 
80
.. i18n: :Second Example:
 
81
 
 
82
:Second Example:
 
83
 
 
84
.. i18n: .. code-block:: xml
 
85
.. i18n: 
 
86
.. i18n:        <record model="ir.ui.view" id="view_partner_form">
 
87
.. i18n:            <field name="name">res.partner.form.inherit</field>
 
88
.. i18n:            <field name="model">res.partner</field>
 
89
.. i18n:            <field name="inherit_id" ref="base.view_partner_form"/>
 
90
.. i18n:            <field name="arch" type="xml">
 
91
.. i18n:                 <page string="Extra Info" position="replace">
 
92
.. i18n:                     <field name="relation_ids" colspan="4" nolabel="1"/>
 
93
.. i18n:                 </page>
 
94
.. i18n:            </field>
 
95
.. i18n:        </record>
 
96
 
 
97
.. code-block:: xml
 
98
 
 
99
        <record model="ir.ui.view" id="view_partner_form">
 
100
            <field name="name">res.partner.form.inherit</field>
 
101
            <field name="model">res.partner</field>
 
102
            <field name="inherit_id" ref="base.view_partner_form"/>
 
103
            <field name="arch" type="xml">
 
104
                 <page string="Extra Info" position="replace">
 
105
                     <field name="relation_ids" colspan="4" nolabel="1"/>
 
106
                 </page>
 
107
            </field>
 
108
        </record>
 
109
 
 
110
.. i18n: Will replace the content of the Extra Info tab of the notebook by one 'relation_ids' field.
 
111
 
 
112
Will replace the content of the Extra Info tab of the notebook by one 'relation_ids' field.
 
113
 
 
114
.. i18n: The parent and the inherited views are correctly updated with --update=all argument like any other views.
 
115
 
 
116
The parent and the inherited views are correctly updated with --update=all argument like any other views.
 
117
 
 
118
.. i18n: To delete a field from a form, an empty element with position="replace" atribute is used. Example:
 
119
 
 
120
To delete a field from a form, an empty element with position="replace" atribute is used. Example:
 
121
 
 
122
.. i18n: .. code-block:: xml
 
123
.. i18n: 
 
124
.. i18n:        <record model="ir.ui.view" id="view_partner_form3">
 
125
.. i18n:            <field name="name">res.partner.form.inherit</field>
 
126
.. i18n:            <field name="model">res.partner</field>
 
127
.. i18n:            <field name="inherit_id" ref="base.view_partner_form"/>
 
128
.. i18n:            <field name="arch" type="xml">
 
129
.. i18n:                 <field name="lang" position="replace"/>
 
130
.. i18n:           </field>
 
131
.. i18n:        </record>
 
132
 
 
133
.. code-block:: xml
 
134
 
 
135
        <record model="ir.ui.view" id="view_partner_form3">
 
136
            <field name="name">res.partner.form.inherit</field>
 
137
            <field name="model">res.partner</field>
 
138
            <field name="inherit_id" ref="base.view_partner_form"/>
 
139
            <field name="arch" type="xml">
 
140
                 <field name="lang" position="replace"/>
 
141
           </field>
 
142
        </record>
 
143
 
 
144
.. i18n: Take into account that only one position="replace" attribute can be used per inherited view so multiple inherited views must be created to make multiple replacements. 
 
145
 
 
146
Take into account that only one position="replace" attribute can be used per inherited view so multiple inherited views must be created to make multiple replacements.