~openerp-community/openobject-doc/ksa-openobject-doc-6.0

« back to all changes in this revision

Viewing changes to i18n/ru/source/developer/Miscellaneous/info_repository.rst

  • Committer: Don Kirkby
  • Date: 2011-02-21 20:46:11 UTC
  • mfrom: (433.1.53 openobject-doc)
  • Revision ID: donkirkby+launpd@gmail.com-20110221204611-1ykt6dmg4k3gh5dh
[MERGE] revisions 477 to 486 from the 5.0 branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
.. i18n: Information Repository
 
3
.. i18n: ======================
 
4
..
 
5
 
 
6
Information Repository
 
7
======================
 
8
 
 
9
.. i18n: The information repository is a semantics tree in which the datas that are not the ressources are stocked. We find in this structure:
 
10
..
 
11
 
 
12
The information repository is a semantics tree in which the datas that are not the ressources are stocked. We find in this structure:
 
13
 
 
14
.. i18n:    1. the values by default
 
15
.. i18n:    2. the conditional values;
 
16
.. i18n:           * the state depends on the zip code,
 
17
.. i18n:           * the payment method depends of the partner, ...
 
18
.. i18n:    3. the reactions to the events client;
 
19
.. i18n:           * click on the invoice menu,
 
20
.. i18n:           * print an invoice,
 
21
.. i18n:           * action on a partner, ...
 
22
..
 
23
 
 
24
   1. the values by default
 
25
   2. the conditional values;
 
26
          * the state depends on the zip code,
 
27
          * the payment method depends of the partner, ...
 
28
   3. the reactions to the events client;
 
29
          * click on the invoice menu,
 
30
          * print an invoice,
 
31
          * action on a partner, ...
 
32
 
 
33
.. i18n: The IR has 3 methods;
 
34
..
 
35
 
 
36
The IR has 3 methods;
 
37
 
 
38
.. i18n:     * add a value in the tree
 
39
.. i18n:     * delete a value in the tree
 
40
.. i18n:     * obtain all the values of a selected sheet
 
41
..
 
42
 
 
43
    * add a value in the tree
 
44
    * delete a value in the tree
 
45
    * obtain all the values of a selected sheet
 
46
 
 
47
.. i18n: Setting Value
 
48
.. i18n: -------------
 
49
..
 
50
 
 
51
Setting Value
 
52
-------------
 
53
 
 
54
.. i18n: The ir_set tag allows you to insert new values in the  "Information
 
55
.. i18n: Repository". This tag must contain several *field* tags with *name* and *eval*
 
56
.. i18n: attributes.
 
57
..
 
58
 
 
59
The ir_set tag allows you to insert new values in the  "Information
 
60
Repository". This tag must contain several *field* tags with *name* and *eval*
 
61
attributes.
 
62
 
 
63
.. i18n: The attributes are those defined by the access methods to the information
 
64
.. i18n: repository. We must provide it with several attributes: *keys*, *args*, *name*,
 
65
.. i18n: *value*, *isobject*, *replace*, *meta* and some optional fields.
 
66
..
 
67
 
 
68
The attributes are those defined by the access methods to the information
 
69
repository. We must provide it with several attributes: *keys*, *args*, *name*,
 
70
*value*, *isobject*, *replace*, *meta* and some optional fields.
 
71
 
 
72
.. i18n: Example:
 
73
..
 
74
 
 
75
Example:
 
76
 
 
77
.. i18n: .. code-block:: xml
 
78
.. i18n: 
 
79
.. i18n:     <ir_set>
 
80
.. i18n:         <field name="keys" eval="[('action','client_print_multi'),('res_model','account.invoice')]"/>
 
81
.. i18n:         <field name="args" eval="[]"/>
 
82
.. i18n:         <field name="name">Print Invoices</field>
 
83
.. i18n:         <field name="value" eval="'ir.actions.report.xml,'+str(l0)"/>
 
84
.. i18n:         <field name="isobject" eval="True"/>
 
85
.. i18n:         <field name="replace" eval="False"/>
 
86
.. i18n:     </ir_set>
 
87
..
 
88
 
 
89
.. code-block:: xml
 
90
 
 
91
    <ir_set>
 
92
        <field name="keys" eval="[('action','client_print_multi'),('res_model','account.invoice')]"/>
 
93
        <field name="args" eval="[]"/>
 
94
        <field name="name">Print Invoices</field>
 
95
        <field name="value" eval="'ir.actions.report.xml,'+str(l0)"/>
 
96
        <field name="isobject" eval="True"/>
 
97
        <field name="replace" eval="False"/>
 
98
    </ir_set>
 
99
 
 
100
.. i18n: IR Methods
 
101
.. i18n: -----------
 
102
..
 
103
 
 
104
IR Methods
 
105
-----------
 
106
 
 
107
.. i18n: .. code-block:: python
 
108
.. i18n: 
 
109
.. i18n:     def ir_set(cr, uid, key, key2, name, models, value, replace=True, isobject=False, meta=None)
 
110
..
 
111
 
 
112
.. code-block:: python
 
113
 
 
114
    def ir_set(cr, uid, key, key2, name, models, value, replace=True, isobject=False, meta=None)
 
115
 
 
116
.. i18n: .. code-block:: python
 
117
.. i18n: 
 
118
.. i18n:     def ir_get(cr, uid, key, key2, models, meta=False, context={}, res_id_req=False)
 
119
..
 
120
 
 
121
.. code-block:: python
 
122
 
 
123
    def ir_get(cr, uid, key, key2, models, meta=False, context={}, res_id_req=False)
 
124
 
 
125
.. i18n: .. code-block:: python
 
126
.. i18n: 
 
127
.. i18n:     def ir_del(cr, uid, id):
 
128
..
 
129
 
 
130
.. code-block:: python
 
131
 
 
132
    def ir_del(cr, uid, id):
 
133
 
 
134
.. i18n: :Description of the fields:
 
135
..
 
136
 
 
137
:Description of the fields:
 
138
 
 
139
.. i18n:    1. key:
 
140
.. i18n:    2. key2:
 
141
.. i18n:    3. name:
 
142
.. i18n:    4. models:
 
143
.. i18n:    5. value:
 
144
.. i18n:    6. isobject:
 
145
.. i18n:    7. replace: whether or not the action described should override an existing action or be appended to the list of actions.
 
146
.. i18n:    8. meta:
 
147
..
 
148
 
 
149
   1. key:
 
150
   2. key2:
 
151
   3. name:
 
152
   4. models:
 
153
   5. value:
 
154
   6. isobject:
 
155
   7. replace: whether or not the action described should override an existing action or be appended to the list of actions.
 
156
   8. meta:
 
157
 
 
158
.. i18n: :Using ir_set and ir_get:
 
159
..
 
160
 
 
161
:Using ir_set and ir_get:
 
162
 
 
163
.. i18n: .. code-block:: python
 
164
.. i18n: 
 
165
.. i18n:     ...
 
166
.. i18n: 
 
167
.. i18n:         res = ir.ir_set(cr, uid, key, key2, name, models, value, replace, isobject, meta)
 
168
.. i18n: 
 
169
.. i18n:     ...
 
170
.. i18n: 
 
171
.. i18n:     ...
 
172
.. i18n: 
 
173
.. i18n:         if not report.menu_id:
 
174
.. i18n: 
 
175
.. i18n:             ir.ir_set(cr, uid, 'action', 'client_print_multi', name, [(model, False)], action, False, True)
 
176
.. i18n: 
 
177
.. i18n:         else:
 
178
.. i18n: 
 
179
.. i18n:             ir.ir_set(cr, uid, 'action', 'tree_but_open', 'Menuitem', [('ir.ui.menu', int(m_id))], action, False, True)
 
180
.. i18n: 
 
181
.. i18n:     ...
 
182
.. i18n: 
 
183
.. i18n:     ...
 
184
.. i18n: 
 
185
.. i18n:         res = ir.ir_get(cr, uid, [('default', self._name), ('field', False)], [('user_id',str(uid))])
 
186
.. i18n: 
 
187
.. i18n:     ...
 
188
.. i18n: 
 
189
.. i18n:         account_payable = ir.ir_get(cr, uid, [('meta','res.partner'), ('name','account.payable')], opt)[0][2]
 
190
.. i18n: 
 
191
.. i18n:     ...
 
192
..
 
193
 
 
194
.. code-block:: python
 
195
 
 
196
    ...
 
197
 
 
198
        res = ir.ir_set(cr, uid, key, key2, name, models, value, replace, isobject, meta)
 
199
 
 
200
    ...
 
201
 
 
202
    ...
 
203
 
 
204
        if not report.menu_id:
 
205
 
 
206
            ir.ir_set(cr, uid, 'action', 'client_print_multi', name, [(model, False)], action, False, True)
 
207
 
 
208
        else:
 
209
 
 
210
            ir.ir_set(cr, uid, 'action', 'tree_but_open', 'Menuitem', [('ir.ui.menu', int(m_id))], action, False, True)
 
211
 
 
212
    ...
 
213
 
 
214
    ...
 
215
 
 
216
        res = ir.ir_get(cr, uid, [('default', self._name), ('field', False)], [('user_id',str(uid))])
 
217
 
 
218
    ...
 
219
 
 
220
        account_payable = ir.ir_get(cr, uid, [('meta','res.partner'), ('name','account.payable')], opt)[0][2]
 
221
 
 
222
    ...