Author: |
Naglis Jonaitis |
License: |
LGPL-3 |
Branch: |
15.0 |
Repository: |
focusate/naglis-misc-addons |
Dependencies: |
bus,
and
web |
Languages: |
JavaScript (51, 33.8%),
Python (60, 39.7%),
XML (29, 19.2%),
and
reStructuredText (11, 7.3%) |
Other branches: |
11.0,
12.0,
12.0-port-web_notify_action,
and
fix-redirect-call |
Other repositories: |
Drsmartinkus/misc-addons,
Guobower/misc-addons,
IaseshviliGeorgiy/misc-addons,
TRESCLOUD/misc-addons,
Vassy/misc-addons,
crtmneric/misc-addons-1,
grottas/misc-addons-1,
mucahitaz/misc-addons,
naglis/misc-addons,
sasakuma/misc-addons-1,
sm2x/misc-addons-1,
and
versada/misc-addons |
<h1 class="title">User Action Notfications</h1>
<p>Server-initiated action notifications on steroids!</p>
<pre>
<code lang="python">self.env.user._notify_action({
"title": "Hello World",
"message": "This is a notification with custom actions.",
"type": "notification", # Possible values: ['notification', 'warning']. Default: 'notification'
"icon": "fa-check", # Font Awesome class
"image_url": "https://odoocdn.com/openerp_website/static/src/img/assets/png/odoo_logo.png",
"timeout": 2500, # In miliseconds. Ignored if sticky = True. Default: 2500
"sticky": True, # If true, do not close notification automatically. Default: False
"buttons": [{
"primary": True, # If true, display button as primary.
"text": "Open", # Button label text.
"icon": "fa-users", # Font Awesome class or image URL.
"action": { # Any action dict that can be executed by the action manager.
"type": "ir.actions.act_window",
"view_mode": "tree",
"res_model": "res.users",
"views": [[False, 'list'], [False,'form']],
"name": "Users",
"target": "new",
},
}, {
"primary": False,
"text": "Open URL",
"icon": "fa-link",
"action": {
"type": "ir.actions.act_url",
"url": "https://naglis.me/",
"target": "new",
}
}],
})</code>
</pre>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">HTML in <cite>title</cite> or <cite>message</cite> is not supported due to safety concerns.</p>
</div>
<a name="todo"></a>
<h2>TODO</h2>
<ul class="simple">
<li>JavaScript tests.</li>
<li>Documentation and demos.</li>
<li>Multi-action via drop-down button.</li>
<li>Model method call actions?</li>
<li>Progress bar?</li>
</ul>