mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[IMP] web_notify: Add possibility to return an action in a notification
This commit is contained in:
committed by
Laurent Stukkens
parent
dac33645f2
commit
5d1c3d5fd7
@@ -7,7 +7,7 @@ Web Notify
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:5939f6a4cc411dab0ff9e45a43676cbcf8ecafcd7718961aee386fefc24e189d
|
||||
!! source digest: sha256:1a956defc8dc9d2b860d2c19783b48bc95edb7578e8178737badb6bae2b29cf6
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png
|
||||
@@ -83,6 +83,27 @@ or
|
||||
|
||||
self.env.user.notify_default(message='My default message')
|
||||
|
||||
|
||||
The notifications can bring interactivity with some buttons.
|
||||
|
||||
* One allowing to refresh the active view
|
||||
* Another allowing to send a window / client action
|
||||
|
||||
The reload button is activated when sending the notification with:
|
||||
|
||||
|
||||
The action can be used using the ``action`` keyword:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
action = self.env["ir.actions.act_window"]._for_xml_id('sale.action_orders')
|
||||
action.update({
|
||||
'res_id': self.id,
|
||||
'views': [(False, 'form')],
|
||||
})
|
||||
self.env.user.notify_info('My information message', action=action)
|
||||
|
||||
|
||||
.. figure:: https://raw.githubusercontent.com/OCA/web/15.0/web_notify/static/description/notifications_screenshot.gif
|
||||
:scale: 80 %
|
||||
:alt: Sample notifications
|
||||
|
||||
Reference in New Issue
Block a user