mirror of https://github.com/OCA/web.git
[UPD] README.rst
parent
e2b9f527d9
commit
aa5c45a69b
|
@ -30,8 +30,11 @@ Send instant notification messages to the user in live.
|
|||
This technical module allows you to send instant notification messages from the server to the user in live.
|
||||
Two kinds of notification are supported.
|
||||
|
||||
* Warning: Displayed in a red flying popup div
|
||||
* Information: Displayed in a light yellow flying popup div
|
||||
* Success: Displayed in a `success` theme color flying popup div
|
||||
* Danger: Displayed in a `danger` theme color flying popup div
|
||||
* Warning: Displayed in a `warning` theme color flying popup div
|
||||
* Information: Displayed in a `info` theme color flying popup div
|
||||
* Default: Displayed in a `default` theme color flying popup div
|
||||
|
||||
**Table of contents**
|
||||
|
||||
|
@ -49,6 +52,24 @@ Usage
|
|||
|
||||
To send a notification to the user you just need to call one of the new methods defined on res.users:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
self.env.user.notify_success(message='My success message')
|
||||
|
||||
or
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
self.env.user.notify_danger(message='My danger message')
|
||||
|
||||
or
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
self.env.user.notify_warning(message='My warning message')
|
||||
|
||||
or
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
self.env.user.notify_info(message='My information message')
|
||||
|
@ -57,7 +78,7 @@ or
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
self.env.user.notify_warning(message='My marning message')
|
||||
self.env.user.notify_default(message='My default message')
|
||||
|
||||
.. figure:: https://raw.githubusercontent.com/OCA/web/12.0/web_notify/static/description/notifications_screenshot.png
|
||||
:scale: 80 %
|
||||
|
@ -95,6 +116,7 @@ Contributors
|
|||
* Laurent Mignon <laurent.mignon@acsone.eu>
|
||||
* Serpent Consulting Services Pvt. Ltd.<jay.vora@serpentcs.com>
|
||||
* Aitor Bouzas <aitor.bouzas@adaptivecity.com>
|
||||
* Shepilov Vladislav <shepilov.v@protonmail.com>
|
||||
|
||||
Maintainers
|
||||
~~~~~~~~~~~
|
||||
|
|
|
@ -372,8 +372,11 @@ ul.auto-toc {
|
|||
<p>This technical module allows you to send instant notification messages from the server to the user in live.
|
||||
Two kinds of notification are supported.</p>
|
||||
<ul class="simple">
|
||||
<li>Warning: Displayed in a red flying popup div</li>
|
||||
<li>Information: Displayed in a light yellow flying popup div</li>
|
||||
<li>Success: Displayed in a <cite>success</cite> theme color flying popup div</li>
|
||||
<li>Danger: Displayed in a <cite>danger</cite> theme color flying popup div</li>
|
||||
<li>Warning: Displayed in a <cite>warning</cite> theme color flying popup div</li>
|
||||
<li>Information: Displayed in a <cite>info</cite> theme color flying popup div</li>
|
||||
<li>Default: Displayed in a <cite>default</cite> theme color flying popup div</li>
|
||||
</ul>
|
||||
<p><strong>Table of contents</strong></p>
|
||||
<div class="contents local topic" id="contents">
|
||||
|
@ -397,11 +400,23 @@ Two kinds of notification are supported.</p>
|
|||
<h1><a class="toc-backref" href="#id2">Usage</a></h1>
|
||||
<p>To send a notification to the user you just need to call one of the new methods defined on res.users:</p>
|
||||
<pre class="code python literal-block">
|
||||
<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_success</span><span class="p">(</span><span class="n">message</span><span class="o">=</span><span class="s1">'My success message'</span><span class="p">)</span>
|
||||
</pre>
|
||||
<p>or</p>
|
||||
<pre class="code python literal-block">
|
||||
<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_danger</span><span class="p">(</span><span class="n">message</span><span class="o">=</span><span class="s1">'My danger message'</span><span class="p">)</span>
|
||||
</pre>
|
||||
<p>or</p>
|
||||
<pre class="code python literal-block">
|
||||
<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_warning</span><span class="p">(</span><span class="n">message</span><span class="o">=</span><span class="s1">'My warning message'</span><span class="p">)</span>
|
||||
</pre>
|
||||
<p>or</p>
|
||||
<pre class="code python literal-block">
|
||||
<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="n">message</span><span class="o">=</span><span class="s1">'My information message'</span><span class="p">)</span>
|
||||
</pre>
|
||||
<p>or</p>
|
||||
<pre class="code python literal-block">
|
||||
<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_warning</span><span class="p">(</span><span class="n">message</span><span class="o">=</span><span class="s1">'My marning message'</span><span class="p">)</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_default</span><span class="p">(</span><span class="n">message</span><span class="o">=</span><span class="s1">'My default message'</span><span class="p">)</span>
|
||||
</pre>
|
||||
<div class="figure">
|
||||
<img alt="Sample notifications" src="https://raw.githubusercontent.com/OCA/web/12.0/web_notify/static/description/notifications_screenshot.png" />
|
||||
|
@ -435,6 +450,7 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
|
|||
<li>Laurent Mignon <<a class="reference external" href="mailto:laurent.mignon@acsone.eu">laurent.mignon@acsone.eu</a>></li>
|
||||
<li>Serpent Consulting Services Pvt. Ltd.<<a class="reference external" href="mailto:jay.vora@serpentcs.com">jay.vora@serpentcs.com</a>></li>
|
||||
<li>Aitor Bouzas <<a class="reference external" href="mailto:aitor.bouzas@adaptivecity.com">aitor.bouzas@adaptivecity.com</a>></li>
|
||||
<li>Shepilov Vladislav <<a class="reference external" href="mailto:shepilov.v@protonmail.com">shepilov.v@protonmail.com</a>></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
|
|
Loading…
Reference in New Issue