-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] web_notify: action button name and close
- We can now set a button name to the notification action. - We can set an icon button as well. - After the button is clicked, the notification gets closed.
- Loading branch information
1 parent
800311a
commit a91a2e1
Showing
6 changed files
with
62 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | ||
<head> | ||
|
@@ -8,10 +9,11 @@ | |
|
||
/* | ||
:Author: David Goodger ([email protected]) | ||
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ | ||
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ | ||
:Copyright: This stylesheet has been placed in the public domain. | ||
|
||
Default cascading style sheet for the HTML output of Docutils. | ||
Despite the name, some widely supported CSS2 features are used. | ||
|
||
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to | ||
customize this style sheet. | ||
|
@@ -274,7 +276,7 @@ | |
margin-left: 2em ; | ||
margin-right: 2em } | ||
|
||
pre.code .ln { color: grey; } /* line numbers */ | ||
pre.code .ln { color: gray; } /* line numbers */ | ||
pre.code, code { background-color: #eeeeee } | ||
pre.code .comment, code .comment { color: #5C6576 } | ||
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } | ||
|
@@ -300,7 +302,7 @@ | |
span.pre { | ||
white-space: pre } | ||
|
||
span.problematic { | ||
span.problematic, pre.problematic { | ||
color: red } | ||
|
||
span.section-subtitle { | ||
|
@@ -366,7 +368,7 @@ <h1 class="title">Web Notify</h1> | |
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:2ea37128bc36b2b82559d0718dff171b9d2e3dcde596a8c8750d6926821862fc | ||
!! source digest: sha256:967b84f947ab892f664ee846a3d5c4e59a203a30a42264fe14fc9dd300c18c07 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> | ||
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/web/tree/15.0/web_notify"><img alt="OCA/web" src="https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/web-15-0/web-15-0-web_notify"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p> | ||
<p>Send instant notification messages to the user in live.</p> | ||
|
@@ -425,22 +427,25 @@ <h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1> | |
<li>Another allowing to send a window / client action</li> | ||
</ul> | ||
<p>The reload button is activated when sending the notification with:</p> | ||
<p>The action can be used using the <tt class="docutils literal">action</tt> keyword:</p> | ||
<p>The action can be used using the <tt class="docutils literal">action</tt> keyword and we can choose which name to | ||
give to our button with the <tt class="docutils literal">button_name</tt> key in the action context <cite>params</cite> key:</p> | ||
<pre class="code python literal-block"> | ||
<span class="n">action</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="p">[</span><span class="s2">"ir.actions.act_window"</span><span class="p">]</span><span class="o">.</span><span class="n">_for_xml_id</span><span class="p">(</span><span class="s1">'sale.action_orders'</span><span class="p">)</span><span class="w"> | ||
</span> <span class="n">action</span><span class="o">.</span><span class="n">update</span><span class="p">({</span><span class="w"> | ||
</span> <span class="s1">'res_id'</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">id</span><span class="p">,</span><span class="w"> | ||
</span> <span class="s1">'views'</span><span class="p">:</span> <span class="p">[(</span><span class="kc">False</span><span class="p">,</span> <span class="s1">'form'</span><span class="p">)],</span><span class="w"> | ||
</span> <span class="p">})</span><span class="w"> | ||
<span class="n">action</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="p">[</span><span class="s2">"ir.actions.act_window"</span><span class="p">]</span><span class="o">.</span><span class="n">_for_xml_id</span><span class="p">(</span><span class="s1">'sale.action_orders'</span><span class="p">)</span><span class="w"> | ||
</span><span class="n">action</span><span class="o">.</span><span class="n">update</span><span class="p">({</span><span class="w"> | ||
</span> <span class="s1">'res_id'</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">id</span><span class="p">,</span><span class="w"> | ||
</span> <span class="s1">'views'</span><span class="p">:</span> <span class="p">[(</span><span class="kc">False</span><span class="p">,</span> <span class="s1">'form'</span><span class="p">)],</span><span class="w"> | ||
</span><span class="p">})</span><span class="w"> | ||
</span><span class="n">action</span><span class="p">[</span><span class="s2">"context"</span><span class="p">]</span><span class="o">.</span><span class="n">setdefault</span><span class="p">(</span><span class="s2">"params"</span><span class="p">,</span> <span class="p">{})</span><span class="w"> | ||
</span><span class="n">action</span><span class="p">[</span><span class="s2">"context"</span><span class="p">][</span><span class="s2">"params"</span><span class="p">][</span><span class="s2">"button_name"</span><span class="p">]</span> <span class="o">=</span> <span class="s2">"Sales"</span><span class="w"> | ||
</span><span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="o">.</span><span class="n">user</span><span class="o">.</span><span class="n">notify_info</span><span class="p">(</span><span class="s1">'My information message'</span><span class="p">,</span> <span class="n">action</span><span class="o">=</span><span class="n">action</span><span class="p">)</span> | ||
</pre> | ||
<div class="figure"> | ||
<img alt="Sample notifications" src="https://raw.githubusercontent.com/OCA/web/15.0/web_notify/static/description/notifications_screenshot.gif" /> | ||
<img alt="Sample notifications" src="https://raw.githubusercontent.com/OCA/web/15.0/web_notify/static/img/notifications_screenshot.gif" /> | ||
</div> | ||
<p>You can test the behaviour of the notifications by installing this module in a demo database. | ||
Access the users form through Settings -> Users & Companies. You’ll see a tab called “Test web notify”, here you’ll find two buttons that’ll allow you test the module.</p> | ||
<div class="figure"> | ||
<img alt="Sample notifications" src="https://raw.githubusercontent.com/OCA/web/15.0/web_notify/static/description/test_notifications_demo.png" /> | ||
<img alt="Sample notifications" src="https://raw.githubusercontent.com/OCA/web/15.0/web_notify/static/img/test_notifications_demo.png" /> | ||
</div> | ||
</div> | ||
<div class="section" id="bug-tracker"> | ||
|
@@ -477,7 +482,9 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2> | |
<div class="section" id="maintainers"> | ||
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2> | ||
<p>This module is maintained by the OCA.</p> | ||
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a> | ||
<a class="reference external image-reference" href="https://odoo-community.org"> | ||
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /> | ||
</a> | ||
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
mission is to support the collaborative development of Odoo features and | ||
promote its widespread use.</p> | ||
|
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters