You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.0 KiB

  1. To send a notification to the user you just need to call one of the new methods defined on res.users:
  2. .. code-block:: python
  3. self.env.user.notify_success(message='My success message')
  4. or
  5. .. code-block:: python
  6. self.env.user.notify_danger(message='My danger message')
  7. or
  8. .. code-block:: python
  9. self.env.user.notify_warning(message='My warning message')
  10. or
  11. .. code-block:: python
  12. self.env.user.notify_info(message='My information message')
  13. or
  14. .. code-block:: python
  15. self.env.user.notify_default(message='My default message')
  16. .. figure:: static/description/notifications_screenshot.png
  17. :scale: 80 %
  18. :alt: Sample notifications
  19. You can test the behaviour of the notifications by installing this module in a demo database.
  20. 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.
  21. .. figure:: static/description/test_notifications_demo.png
  22. :scale: 80 %
  23. :alt: Sample notifications