~xrg/openobject-doc/trunk-xrg

« back to all changes in this revision

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