20
20
There are different types of simple actions:
22
.. i18n: * Window: Opening of a new window
23
.. i18n: * Report: The printing of a report
24
.. i18n: o Custom Report: The personalized reports
25
.. i18n: o RML Report: The XSL:RML reports
26
.. i18n: * Wizard: The beginning of a Wizard
27
.. i18n: * Execute: The execution of a method on the server side
28
.. i18n: * Group: Gather some actions in one group
22
.. i18n: * Window: Opening of a new window
23
.. i18n: * Report: The printing of a report
24
.. i18n: o Custom Report: The personalized reports
25
.. i18n: o RML Report: The XSL:RML reports
26
.. i18n: * Wizard: The beginning of a Wizard
27
.. i18n: * Execute: The execution of a method on the server side
28
.. i18n: * Group: Gather some actions in one group
30
30
* Window: Opening of a new window
31
31
* Report: The printing of a report
40
40
The actions are used for the following events;
42
.. i18n: * User connection,
43
.. i18n: * The user double-clicks on the menu,
44
.. i18n: * The user clicks on the icon 'print' or 'action'.
42
.. i18n: * User connection,
43
.. i18n: * The user double-clicks on the menu,
44
.. i18n: * The user clicks on the icon 'print' or 'action'.
47
47
* The user double-clicks on the menu,
58
58
In Open ERP, all the actions are described and not configured. Two examples:
60
.. i18n: * Opening of a window when double-clicking in the menu
61
.. i18n: * User connection
60
.. i18n: * Opening of a window when double-clicking in the menu
61
.. i18n: * User connection
63
63
* Opening of a window when double-clicking in the menu
74
74
When the user open the option of the menu "Operations > Partners > Partners Contact", the next steps are done to give the user information on the action to undertake.
76
.. i18n: 1. Search the action in the IR.
77
.. i18n: 2. Execution of the action
78
.. i18n: 1. If the action is the type Opening the Window; it indicates to the user that a new window must be opened for a selected object and it gives you the view (form or list) and the filed to use (only the pro-forma invoice).
79
.. i18n: 2. The user asks the object and receives information necessary to trace a form; the fields description and the XML view.
76
.. i18n: 1. Search the action in the IR.
77
.. i18n: 2. Execution of the action
78
.. i18n: 1. If the action is the type Opening the Window; it indicates to the user that a new window must be opened for a selected object and it gives you the view (form or list) and the filed to use (only the pro-forma invoice).
79
.. i18n: 2. The user asks the object and receives information necessary to trace a form; the fields description and the XML view.
81
81
1. Search the action in the IR.
82
82
2. Execution of the action
100
.. i18n: 1. Reading of a user file to obtain ACTION_ID
101
.. i18n: 2. Reading of the action and execution of this one
100
.. i18n: 1. Reading of a user file to obtain ACTION_ID
101
.. i18n: 2. Reading of the action and execution of this one
103
103
1. Reading of a user file to obtain ACTION_ID
104
104
2. Reading of the action and execution of this one
112
112
.. i18n: **Action Name**
113
.. i18n: The action name
113
.. i18n: The action name
114
114
.. i18n: **Action Type**
115
.. i18n: Always 'ir.actions.act_window'
115
.. i18n: Always 'ir.actions.act_window'
116
116
.. i18n: **View Ref**
117
.. i18n: The view used for showing the object
117
.. i18n: The view used for showing the object
118
118
.. i18n: **Model**
119
.. i18n: The model of the object to post
119
.. i18n: The model of the object to post
120
120
.. i18n: **Type of View**
121
.. i18n: The type of view (Tree/Form)
121
.. i18n: The type of view (Tree/Form)
122
122
.. i18n: **Domain Value**
123
.. i18n: The domain that decreases the visible data with this view
123
.. i18n: The domain that decreases the visible data with this view
166
166
The domains are written in python; list of tuples. The tuples have three elements;
168
.. i18n: * the field on which the test must be done
169
.. i18n: * the operator used for the test (<, >, =, like)
170
.. i18n: * the tested value
168
.. i18n: * the field on which the test must be done
169
.. i18n: * the operator used for the test (<, >, =, like)
170
.. i18n: * the tested value
172
172
* the field on which the test must be done
173
173
* the operator used for the test (<, >, =, like)
190
190
.. i18n: Actions are explained in more detail in section "Administration Modules - Actions". Here's the template of an action XML record :
193
<record model="ir.actions.act_window" id="action_id_1">
194
<field name="name">action.name</field>
195
<field name="view_id" ref="view_id_1"/>
196
<field name="domain">["list of 3-tuples (max 250 characters)"]</field>
197
<field name="context">{"context dictionary (max 250 characters)"}</field>
198
<field name="res_model">Open.object</field>
199
<field name="view_type">form|tree</field>
200
<field name="view_mode">form,tree|tree,form|form|tree</field>
201
<field name="usage">menu</field>
202
<field name="target">new</field>
205
.. i18n: <record model="ir.actions.act_window" id="action_id_1">
206
.. i18n: <field name="name">action.name</field>
207
.. i18n: <field name="view_id" ref="view_id_1"/>
208
.. i18n: <field name="domain">["list of 3-tuples (max 250 characters)"]</field>
209
.. i18n: <field name="context">{"context dictionary (max 250 characters)"}</field>
210
.. i18n: <field name="res_model">Open.object</field>
211
.. i18n: <field name="view_type">form|tree</field>
212
.. i18n: <field name="view_mode">form,tree|tree,form|form|tree</field>
213
.. i18n: <field name="usage">menu</field>
214
.. i18n: <field name="target">new</field>
193
.. i18n: <record model="ir.actions.act_window" id="action_id_1">
194
.. i18n: <field name="name">action.name</field>
195
.. i18n: <field name="view_id" ref="view_id_1"/>
196
.. i18n: <field name="domain">["list of 3-tuples (max 250 characters)"]</field>
197
.. i18n: <field name="context">{"context dictionary (max 250 characters)"}</field>
198
.. i18n: <field name="res_model">Open.object</field>
199
.. i18n: <field name="view_type">form|tree</field>
200
.. i18n: <field name="view_mode">form,tree|tree,form|form|tree</field>
201
.. i18n: <field name="usage">menu</field>
202
.. i18n: <field name="target">new</field>
205
Actions are explained in more detail in section "Administration Modules - Actions". Here's the template of an action XML record :
217
208
<record model="ir.actions.act_window" id="action_id_1">
218
209
<field name="name">action.name</field>
233
.. i18n: * **id** is the identifier of the action in the table "ir.actions.act_window". It must be unique.
234
.. i18n: * **name** is the name of the action (mandatory).
235
.. i18n: * **view_id** is the name of the view to display when the action is activated. If this field is not defined, the view of a kind (list or form) associated to the object res_model with the highest priority field is used (if two views have the same priority, the first defined view of a kind is used).
236
.. i18n: * **domain** is a list of constraints used to refine the results of a selection, and hence to get less records displayed in the view. Constraints of the list are linked together with an AND clause : a record of the table will be displayed in the view only if all the constraints are satisfied.
237
.. i18n: * **context** is the context dictionary which will be visible in the view that will be opened when the action is activated. Context dictionaries are declared with the same syntax as Python dictionaries in the XML file. For more information about context dictionaries, see section " The context Dictionary".
238
.. i18n: * **res_model** is the name of the object on which the action operates.
239
.. i18n: * **view_type** is set to form when the action must open a new form view, and is set to tree when the action must open a new tree view.
240
.. i18n: * **view_mode** is only considered if view_type is form, and ignored otherwise. The four possibilities are :
241
.. i18n: - **form,tree** : the view is first displayed as a form, the list view can be displayed by clicking the "alternate view button" ;
242
.. i18n: - **tree,form** : the view is first displayed as a list, the form view can be displayed by clicking the "alternate view button" ;
243
.. i18n: - **form** : the view is displayed as a form and there is no way to switch to list view ;
244
.. i18n: - **tree** : the view is displayed as a list and there is no way to switch to form view.
224
.. i18n: * **id** is the identifier of the action in the table "ir.actions.act_window". It must be unique.
225
.. i18n: * **name** is the name of the action (mandatory).
226
.. i18n: * **view_id** is the name of the view to display when the action is activated. If this field is not defined, the view of a kind (list or form) associated to the object res_model with the highest priority field is used (if two views have the same priority, the first defined view of a kind is used).
227
.. i18n: * **domain** is a list of constraints used to refine the results of a selection, and hence to get less records displayed in the view. Constraints of the list are linked together with an AND clause : a record of the table will be displayed in the view only if all the constraints are satisfied.
228
.. i18n: * **context** is the context dictionary which will be visible in the view that will be opened when the action is activated. Context dictionaries are declared with the same syntax as Python dictionaries in the XML file. For more information about context dictionaries, see section " The context Dictionary".
229
.. i18n: * **res_model** is the name of the object on which the action operates.
230
.. i18n: * **view_type** is set to form when the action must open a new form view, and is set to tree when the action must open a new tree view.
231
.. i18n: * **view_mode** is only considered if view_type is form, and ignored otherwise. The four possibilities are :
232
.. i18n: - **form,tree** : the view is first displayed as a form, the list view can be displayed by clicking the "alternate view button" ;
233
.. i18n: - **tree,form** : the view is first displayed as a list, the form view can be displayed by clicking the "alternate view button" ;
234
.. i18n: - **form** : the view is displayed as a form and there is no way to switch to list view ;
235
.. i18n: - **tree** : the view is displayed as a list and there is no way to switch to form view.
246
237
* **id** is the identifier of the action in the table "ir.actions.act_window". It must be unique.
247
238
* **name** is the name of the action (mandatory).
261
252
(version 5 introduced **graph** and **calendar** views)
263
.. i18n: * **usage** is used [+ ***TODO*** +]
264
.. i18n: * **target** the view will open in new window like wizard.
254
.. i18n: * **usage** is used [+ ***TODO*** +]
255
.. i18n: * **target** the view will open in new window like wizard.
266
257
* **usage** is used [+ ***TODO*** +]
267
258
* **target** the view will open in new window like wizard.
291
282
.. i18n: This action is declared in server/bin/addons/project/project_view.xml.
294
<record model="ir.actions.act_window" id="open_view_my_project">
295
<field name="name">project.project</field>
296
<field name="res_model">project.project</field>
297
<field name="view_type">tree</field>
298
<field name="domain">[('parent_id','=',False), ('manager', '=', uid)]</field>
299
<field name="view_id" ref="view_my_project" />
302
.. i18n: <record model="ir.actions.act_window" id="open_view_my_project">
303
.. i18n: <field name="name">project.project</field>
304
.. i18n: <field name="res_model">project.project</field>
305
.. i18n: <field name="view_type">tree</field>
306
.. i18n: <field name="domain">[('parent_id','=',False), ('manager', '=', uid)]</field>
307
.. i18n: <field name="view_id" ref="view_my_project" />
285
.. i18n: <record model="ir.actions.act_window" id="open_view_my_project">
286
.. i18n: <field name="name">project.project</field>
287
.. i18n: <field name="res_model">project.project</field>
288
.. i18n: <field name="view_type">tree</field>
289
.. i18n: <field name="domain">[('parent_id','=',False), ('manager', '=', uid)]</field>
290
.. i18n: <field name="view_id" ref="view_my_project" />
293
This action is declared in server/bin/addons/project/project_view.xml.
310
296
<record model="ir.actions.act_window" id="open_view_my_project">
311
297
<field name="name">project.project</field>
318
304
.. i18n: This action is declared in server/bin/addons/stock/stock_view.xml.
321
<record model="ir.actions.act_window" id="action_picking_form">
322
<field name="name">stock.picking</field>
323
<field name="res_model">stock.picking</field>
324
<field name="type">ir.actions.act_window</field>
325
<field name="view_type">form</field>
326
<field name="view_id" ref="view_picking_form"/>
327
<field name="context">{'contact_display': 'partner'}</field>
330
.. i18n: <record model="ir.actions.act_window" id="action_picking_form">
331
.. i18n: <field name="name">stock.picking</field>
332
.. i18n: <field name="res_model">stock.picking</field>
333
.. i18n: <field name="type">ir.actions.act_window</field>
334
.. i18n: <field name="view_type">form</field>
335
.. i18n: <field name="view_id" ref="view_picking_form"/>
336
.. i18n: <field name="context">{'contact_display': 'partner'}</field>
307
.. i18n: <record model="ir.actions.act_window" id="action_picking_form">
308
.. i18n: <field name="name">stock.picking</field>
309
.. i18n: <field name="res_model">stock.picking</field>
310
.. i18n: <field name="type">ir.actions.act_window</field>
311
.. i18n: <field name="view_type">form</field>
312
.. i18n: <field name="view_id" ref="view_picking_form"/>
313
.. i18n: <field name="context">{'contact_display': 'partner'}</field>
316
This action is declared in server/bin/addons/stock/stock_view.xml.
339
319
<record model="ir.actions.act_window" id="action_picking_form">
340
320
<field name="name">stock.picking</field>
360
340
.. i18n: Here's an example of a .XML file that declares a wizard.
363
<?xml version="1.0"?>
366
<wizard string="Employee Info"
368
name="employee.info.wizard"
369
id="wizard_employee_info"/>
373
.. i18n: <?xml version="1.0"?>
376
.. i18n: <wizard string="Employee Info"
377
.. i18n: model="hr.employee"
378
.. i18n: name="employee.info.wizard"
379
.. i18n: id="wizard_employee_info"/>
343
.. i18n: <?xml version="1.0"?>
346
.. i18n: <wizard string="Employee Info"
347
.. i18n: model="hr.employee"
348
.. i18n: name="employee.info.wizard"
349
.. i18n: id="wizard_employee_info"/>
353
Here's an example of a .XML file that declares a wizard.
383
356
<?xml version="1.0"?>
397
370
.. i18n: also you can add wizard in menu using following xml entry
400
<?xml version="1.0"?>
403
<wizard string="Employee Info"
405
name="employee.info.wizard"
406
id="wizard_employee_info"/>
408
name="Human Resource/Employee Info"
409
action="wizard_employee_info"
411
id="menu_wizard_employee_info"/>
415
.. i18n: <?xml version="1.0"?>
418
.. i18n: <wizard string="Employee Info"
419
.. i18n: model="hr.employee"
420
.. i18n: name="employee.info.wizard"
421
.. i18n: id="wizard_employee_info"/>
423
.. i18n: name="Human Resource/Employee Info"
424
.. i18n: action="wizard_employee_info"
425
.. i18n: type="wizard"
426
.. i18n: id="menu_wizard_employee_info"/>
373
.. i18n: <?xml version="1.0"?>
376
.. i18n: <wizard string="Employee Info"
377
.. i18n: model="hr.employee"
378
.. i18n: name="employee.info.wizard"
379
.. i18n: id="wizard_employee_info"/>
381
.. i18n: name="Human Resource/Employee Info"
382
.. i18n: action="wizard_employee_info"
383
.. i18n: type="wizard"
384
.. i18n: id="menu_wizard_employee_info"/>
388
also you can add wizard in menu using following xml entry
430
391
<?xml version="1.0"?>
457
418
.. i18n: Reports in Open ERP are explained in chapter "Reports Reporting". Here's an example of a XML file that declares a RML report :
460
<?xml version="1.0"?>
463
<report id="sale_category_print"
464
string="Sales Orders By Categories"
466
name="sale_category.print"
467
rml="sale_category/report/sale_category_report.rml"
473
.. i18n: <?xml version="1.0"?>
476
.. i18n: <report id="sale_category_print"
477
.. i18n: string="Sales Orders By Categories"
478
.. i18n: model="sale.order"
479
.. i18n: name="sale_category.print"
480
.. i18n: rml="sale_category/report/sale_category_report.rml"
482
.. i18n: auto="False"/>
421
.. i18n: <?xml version="1.0"?>
424
.. i18n: <report id="sale_category_print"
425
.. i18n: string="Sales Orders By Categories"
426
.. i18n: model="sale.order"
427
.. i18n: name="sale_category.print"
428
.. i18n: rml="sale_category/report/sale_category_report.rml"
430
.. i18n: auto="False"/>
434
Reports in Open ERP are explained in chapter "Reports Reporting". Here's an example of a XML file that declares a RML report :
486
437
<?xml version="1.0"?>
501
452
A report is declared using a **report tag** inside a "data" block. The different arguments of a report tag are :
503
.. i18n: * **id** : an identifier which must be unique.
504
.. i18n: * **string** : the text of the menu that calls the report (if any, see below).
505
.. i18n: * **model** : the Open ERP object on which the report will be rendered.
506
.. i18n: * **rml** : the .RML report model. Important Note : Path is relative to addons/ directory.
507
.. i18n: * **menu** : whether the report will be able to be called directly via the client or not. Setting menu to False is useful in case of reports called by wizards.
508
.. i18n: * **auto** : determines if the .RML file must be parsed using the default parser or not. Using a custom parser allows you to define additional functions to your report.
454
.. i18n: * **id** : an identifier which must be unique.
455
.. i18n: * **string** : the text of the menu that calls the report (if any, see below).
456
.. i18n: * **model** : the Open ERP object on which the report will be rendered.
457
.. i18n: * **rml** : the .RML report model. Important Note : Path is relative to addons/ directory.
458
.. i18n: * **menu** : whether the report will be able to be called directly via the client or not. Setting menu to False is useful in case of reports called by wizards.
459
.. i18n: * **auto** : determines if the .RML file must be parsed using the default parser or not. Using a custom parser allows you to define additional functions to your report.
510
461
* **id** : an identifier which must be unique.
511
462
* **string** : the text of the menu that calls the report (if any, see below).