2
.. i18n: Creating Action
3
.. i18n: ===============
5
.. i18n: Linking events to action
6
.. i18n: -------------------------
12
Linking events to action
13
-------------------------
15
.. i18n: The available type of events are:
18
The available type of events are:
20
.. i18n: * **client_print_multi** (print from a list or form)
21
.. i18n: * **client_action_multi** (action from a list or form)
22
.. i18n: * **tree_but_open** (double click on the item of a tree, like the menu)
23
.. i18n: * **tree_but_action** (action on the items of a tree)
26
* **client_print_multi** (print from a list or form)
27
* **client_action_multi** (action from a list or form)
28
* **tree_but_open** (double click on the item of a tree, like the menu)
29
* **tree_but_action** (action on the items of a tree)
31
.. i18n: To map an events to an action:
34
To map an events to an action:
36
.. i18n: .. code-block:: xml
38
.. i18n: <record model="ir.values" id="ir_open_journal_period">
39
.. i18n: <field name="key2">tree_but_open</field>
40
.. i18n: <field name="model">account.journal.period</field>
41
.. i18n: <field name="name">Open Journal</field>
42
.. i18n: <field name="value" eval="'ir.actions.wizard,%d'%action_move_journal_line_form_select"/>
43
.. i18n: <field name="object" eval="True"/>
49
<record model="ir.values" id="ir_open_journal_period">
50
<field name="key2">tree_but_open</field>
51
<field name="model">account.journal.period</field>
52
<field name="name">Open Journal</field>
53
<field name="value" eval="'ir.actions.wizard,%d'%action_move_journal_line_form_select"/>
54
<field name="object" eval="True"/>
57
.. i18n: If you double click on a journal/period (object: account.journal.period), this will open the selected wizard. (id="action_move_journal_line_form_select").
60
If you double click on a journal/period (object: account.journal.period), this will open the selected wizard. (id="action_move_journal_line_form_select").
62
.. i18n: You can use a res_id field to allow this action only if the user click on a specific object.
65
You can use a res_id field to allow this action only if the user click on a specific object.
67
.. i18n: .. code-block:: xml
69
.. i18n: <record model="ir.values" id="ir_open_journal_period">
70
.. i18n: <field name="key2">tree_but_open</field>
71
.. i18n: <field name="model">account.journal.period</field>
72
.. i18n: <field name="name">Open Journal</field>
73
.. i18n: <field name="value" eval="'ir.actions.wizard,%d'%action_move_journal_line_form_select"/>
74
.. i18n: <field name="res_id" eval="3"/>
75
.. i18n: <field name="object" eval="True"/>
81
<record model="ir.values" id="ir_open_journal_period">
82
<field name="key2">tree_but_open</field>
83
<field name="model">account.journal.period</field>
84
<field name="name">Open Journal</field>
85
<field name="value" eval="'ir.actions.wizard,%d'%action_move_journal_line_form_select"/>
86
<field name="res_id" eval="3"/>
87
<field name="object" eval="True"/>
90
.. i18n: The action will be triggered if the user clicks on the account.journal.period n°3.
93
The action will be triggered if the user clicks on the account.journal.period n°3.
95
.. i18n: When you declare wizard, report or menus, the ir.values creation is automatically made with these tags:
98
When you declare wizard, report or menus, the ir.values creation is automatically made with these tags:
100
.. i18n: * <wizard... />
101
.. i18n: * <menuitem... />
102
.. i18n: * <report... />
109
.. i18n: So you usually do not need to add the mapping by yourself.
112
So you usually do not need to add the mapping by yourself.