diff --git a/muk_web_client_notification/README.rst b/muk_web_client_notification/README.rst
index 316342f..a100a1e 100644
--- a/muk_web_client_notification/README.rst
+++ b/muk_web_client_notification/README.rst
@@ -1,114 +1,114 @@
-===========================
-MuK Web Client Notification
-===========================
-
-Adds a notification channel to the web client. By sending a message to this
-channel, a notification is send to the web client.
-
-Installation
-============
-
-To install this module, you need to:
-
-Download the module and add it to your Odoo addons folder. Afterward, log on to
-your Odoo server and go to the Apps menu. Trigger the debug mode and update the
-list by clicking on the "Update Apps List" link. Now install the module by
-clicking on the install button.
-
-Another way to install this module is via the package management for Python
-(`PyPI `_).
-
-To install our modules using the package manager make sure
-`odoo-autodiscover `_ is installed
-correctly. Then open a console and install the module by entering the following
-command:
-
-``pip install --extra-index-url https://nexus.mukit.at/repository/odoo/simple ``
-
-The module name consists of the Odoo version and the module name, where
-underscores are replaced by a dash.
-
-**Module:**
-
-``odoo-addon-``
-
-**Example:**
-
-``sudo -H pip3 install --extra-index-url https://nexus.mukit.at/repository/odoo/simple odoo11-addon-muk-utils``
-
-Once the installation has been successfully completed, the app is already in the
-correct folder. Log on to your Odoo server and go to the Apps menu. Trigger the
-debug mode and update the list by clicking on the "Update Apps List" link. Now
-install the module by clicking on the install button.
-
-The biggest advantage of this variant is that you can now also update the app
-using the "pip" command. To do this, enter the following command in your console:
-
-``pip install --upgrade --extra-index-url https://nexus.mukit.at/repository/odoo/simple ``
-
-When the process is finished, restart your server and update the application in
-Odoo. The steps are the same as for the installation only the button has changed
-from "Install" to "Upgrade".
-
-You can also view available Apps directly in our `repository `_
-and find a more detailed installation guide on our `website `_.
-
-For modules licensed under OPL-1, you will receive access data when you purchase
-the module. If the modules were not purchased directly from
-`MuK IT `_ please contact our support (support@mukit.at)
-with a confirmation of purchase to receive the corresponding access data.
-
-Upgrade
-============
-
-To upgrade this module, you need to:
-
-Download the module and add it to your Odoo addons folder. Restart the server
-and log on to your Odoo server. Select the Apps menu and upgrade the module by
-clicking on the upgrade button.
-
-If you installed the module using the "pip" command, you can also update the
-module in the same way. Just type the following command into the console:
-
-``pip install --upgrade --extra-index-url https://nexus.mukit.at/repository/odoo/simple ``
-
-When the process is finished, restart your server and update the application in
-Odoo, just like you would normally.
-
-Configuration
-=============
-
-No additional configuration is needed to use this module.
-
-Usage
-=============
-
-Messages can either be sent via a wizard or directly from the python code either
-via a method in ResUsers or by an entry in the bus system.
-
-Credits
-=======
-
-Contributors
-------------
-
-* Mathias Markl
-
-Images
-------------
-
-Some pictures are based on or inspired by the icon set of Font Awesome:
-
-* `Font Awesome `_
-
-Author & Maintainer
--------------------
-
-This module is maintained by the `MuK IT GmbH `_.
-
-MuK IT is an Austrian company specialized in customizing and extending Odoo.
-We develop custom solutions for your individual needs to help you focus on
-your strength and expertise to grow your business.
-
-If you want to get in touch please contact us via mail
-(sale@mukit.at) or visit our website (https://mukit.at).
+===========================
+MuK Web Client Notification
+===========================
+
+Adds a notification channel to the web client. By sending a message to this
+channel, a notification is send to the web client.
+
+Installation
+============
+
+To install this module, you need to:
+
+Download the module and add it to your Odoo addons folder. Afterward, log on to
+your Odoo server and go to the Apps menu. Trigger the debug mode and update the
+list by clicking on the "Update Apps List" link. Now install the module by
+clicking on the install button.
+
+Another way to install this module is via the package management for Python
+(`PyPI `_).
+
+To install our modules using the package manager make sure
+`odoo-autodiscover `_ is installed
+correctly. Then open a console and install the module by entering the following
+command:
+
+``pip install --extra-index-url https://nexus.mukit.at/repository/odoo/simple ``
+
+The module name consists of the Odoo version and the module name, where
+underscores are replaced by a dash.
+
+**Module:**
+
+``odoo-addon-``
+
+**Example:**
+
+``sudo -H pip3 install --extra-index-url https://nexus.mukit.at/repository/odoo/simple odoo11-addon-muk-utils``
+
+Once the installation has been successfully completed, the app is already in the
+correct folder. Log on to your Odoo server and go to the Apps menu. Trigger the
+debug mode and update the list by clicking on the "Update Apps List" link. Now
+install the module by clicking on the install button.
+
+The biggest advantage of this variant is that you can now also update the app
+using the "pip" command. To do this, enter the following command in your console:
+
+``pip install --upgrade --extra-index-url https://nexus.mukit.at/repository/odoo/simple ``
+
+When the process is finished, restart your server and update the application in
+Odoo. The steps are the same as for the installation only the button has changed
+from "Install" to "Upgrade".
+
+You can also view available Apps directly in our `repository `_
+and find a more detailed installation guide on our `website `_.
+
+For modules licensed under OPL-1, you will receive access data when you purchase
+the module. If the modules were not purchased directly from
+`MuK IT `_ please contact our support (support@mukit.at)
+with a confirmation of purchase to receive the corresponding access data.
+
+Upgrade
+============
+
+To upgrade this module, you need to:
+
+Download the module and add it to your Odoo addons folder. Restart the server
+and log on to your Odoo server. Select the Apps menu and upgrade the module by
+clicking on the upgrade button.
+
+If you installed the module using the "pip" command, you can also update the
+module in the same way. Just type the following command into the console:
+
+``pip install --upgrade --extra-index-url https://nexus.mukit.at/repository/odoo/simple ``
+
+When the process is finished, restart your server and update the application in
+Odoo, just like you would normally.
+
+Configuration
+=============
+
+No additional configuration is needed to use this module.
+
+Usage
+=============
+
+Messages can either be sent via a wizard or directly from the python code either
+via a method in ResUsers or by an entry in the bus system.
+
+Credits
+=======
+
+Contributors
+------------
+
+* Mathias Markl
+
+Images
+------------
+
+Some pictures are based on or inspired by the icon set of Font Awesome:
+
+* `Font Awesome `_
+
+Author & Maintainer
+-------------------
+
+This module is maintained by the `MuK IT GmbH `_.
+
+MuK IT is an Austrian company specialized in customizing and extending Odoo.
+We develop custom solutions for your individual needs to help you focus on
+your strength and expertise to grow your business.
+
+If you want to get in touch please contact us via mail
+(sale@mukit.at) or visit our website (https://mukit.at).
diff --git a/muk_web_client_notification/__init__.py b/muk_web_client_notification/__init__.py
index d0986d0..18de6c7 100644
--- a/muk_web_client_notification/__init__.py
+++ b/muk_web_client_notification/__init__.py
@@ -1,6 +1,9 @@
###################################################################################
#
-# Copyright (C) 2017 MuK IT GmbH
+# Copyright (c) 2017-2019 MuK IT GmbH.
+#
+# This file is part of MuK Web Notification
+# (see https://mukit.at).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -13,7 +16,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
+# along with this program. If not, see .
#
###################################################################################
diff --git a/muk_web_client_notification/__manifest__.py b/muk_web_client_notification/__manifest__.py
index ebda91e..dbf34c1 100644
--- a/muk_web_client_notification/__manifest__.py
+++ b/muk_web_client_notification/__manifest__.py
@@ -1,6 +1,9 @@
###################################################################################
-#
-# Copyright (C) 2017 MuK IT GmbH
+#
+# Copyright (c) 2017-2019 MuK IT GmbH.
+#
+# This file is part of MuK Web Notification
+# (see https://mukit.at).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -13,14 +16,14 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
+# along with this program. If not, see .
#
###################################################################################
{
"name": "MuK Web Notification",
"summary": """Web Client Notification""",
- "version": "12.0.1.0.2",
+ "version": "12.0.2.0.0",
"category": "Extra Tools",
"license": "AGPL-3",
"website": "http://www.mukit.at",
diff --git a/muk_web_client_notification/doc/index.rst b/muk_web_client_notification/doc/index.rst
index 316342f..a100a1e 100644
--- a/muk_web_client_notification/doc/index.rst
+++ b/muk_web_client_notification/doc/index.rst
@@ -1,114 +1,114 @@
-===========================
-MuK Web Client Notification
-===========================
-
-Adds a notification channel to the web client. By sending a message to this
-channel, a notification is send to the web client.
-
-Installation
-============
-
-To install this module, you need to:
-
-Download the module and add it to your Odoo addons folder. Afterward, log on to
-your Odoo server and go to the Apps menu. Trigger the debug mode and update the
-list by clicking on the "Update Apps List" link. Now install the module by
-clicking on the install button.
-
-Another way to install this module is via the package management for Python
-(`PyPI `_).
-
-To install our modules using the package manager make sure
-`odoo-autodiscover `_ is installed
-correctly. Then open a console and install the module by entering the following
-command:
-
-``pip install --extra-index-url https://nexus.mukit.at/repository/odoo/simple ``
-
-The module name consists of the Odoo version and the module name, where
-underscores are replaced by a dash.
-
-**Module:**
-
-``odoo-addon-``
-
-**Example:**
-
-``sudo -H pip3 install --extra-index-url https://nexus.mukit.at/repository/odoo/simple odoo11-addon-muk-utils``
-
-Once the installation has been successfully completed, the app is already in the
-correct folder. Log on to your Odoo server and go to the Apps menu. Trigger the
-debug mode and update the list by clicking on the "Update Apps List" link. Now
-install the module by clicking on the install button.
-
-The biggest advantage of this variant is that you can now also update the app
-using the "pip" command. To do this, enter the following command in your console:
-
-``pip install --upgrade --extra-index-url https://nexus.mukit.at/repository/odoo/simple ``
-
-When the process is finished, restart your server and update the application in
-Odoo. The steps are the same as for the installation only the button has changed
-from "Install" to "Upgrade".
-
-You can also view available Apps directly in our `repository `_
-and find a more detailed installation guide on our `website `_.
-
-For modules licensed under OPL-1, you will receive access data when you purchase
-the module. If the modules were not purchased directly from
-`MuK IT `_ please contact our support (support@mukit.at)
-with a confirmation of purchase to receive the corresponding access data.
-
-Upgrade
-============
-
-To upgrade this module, you need to:
-
-Download the module and add it to your Odoo addons folder. Restart the server
-and log on to your Odoo server. Select the Apps menu and upgrade the module by
-clicking on the upgrade button.
-
-If you installed the module using the "pip" command, you can also update the
-module in the same way. Just type the following command into the console:
-
-``pip install --upgrade --extra-index-url https://nexus.mukit.at/repository/odoo/simple ``
-
-When the process is finished, restart your server and update the application in
-Odoo, just like you would normally.
-
-Configuration
-=============
-
-No additional configuration is needed to use this module.
-
-Usage
-=============
-
-Messages can either be sent via a wizard or directly from the python code either
-via a method in ResUsers or by an entry in the bus system.
-
-Credits
-=======
-
-Contributors
-------------
-
-* Mathias Markl
-
-Images
-------------
-
-Some pictures are based on or inspired by the icon set of Font Awesome:
-
-* `Font Awesome `_
-
-Author & Maintainer
--------------------
-
-This module is maintained by the `MuK IT GmbH `_.
-
-MuK IT is an Austrian company specialized in customizing and extending Odoo.
-We develop custom solutions for your individual needs to help you focus on
-your strength and expertise to grow your business.
-
-If you want to get in touch please contact us via mail
-(sale@mukit.at) or visit our website (https://mukit.at).
+===========================
+MuK Web Client Notification
+===========================
+
+Adds a notification channel to the web client. By sending a message to this
+channel, a notification is send to the web client.
+
+Installation
+============
+
+To install this module, you need to:
+
+Download the module and add it to your Odoo addons folder. Afterward, log on to
+your Odoo server and go to the Apps menu. Trigger the debug mode and update the
+list by clicking on the "Update Apps List" link. Now install the module by
+clicking on the install button.
+
+Another way to install this module is via the package management for Python
+(`PyPI `_).
+
+To install our modules using the package manager make sure
+`odoo-autodiscover `_ is installed
+correctly. Then open a console and install the module by entering the following
+command:
+
+``pip install --extra-index-url https://nexus.mukit.at/repository/odoo/simple ``
+
+The module name consists of the Odoo version and the module name, where
+underscores are replaced by a dash.
+
+**Module:**
+
+``odoo-addon-``
+
+**Example:**
+
+``sudo -H pip3 install --extra-index-url https://nexus.mukit.at/repository/odoo/simple odoo11-addon-muk-utils``
+
+Once the installation has been successfully completed, the app is already in the
+correct folder. Log on to your Odoo server and go to the Apps menu. Trigger the
+debug mode and update the list by clicking on the "Update Apps List" link. Now
+install the module by clicking on the install button.
+
+The biggest advantage of this variant is that you can now also update the app
+using the "pip" command. To do this, enter the following command in your console:
+
+``pip install --upgrade --extra-index-url https://nexus.mukit.at/repository/odoo/simple ``
+
+When the process is finished, restart your server and update the application in
+Odoo. The steps are the same as for the installation only the button has changed
+from "Install" to "Upgrade".
+
+You can also view available Apps directly in our `repository `_
+and find a more detailed installation guide on our `website `_.
+
+For modules licensed under OPL-1, you will receive access data when you purchase
+the module. If the modules were not purchased directly from
+`MuK IT `_ please contact our support (support@mukit.at)
+with a confirmation of purchase to receive the corresponding access data.
+
+Upgrade
+============
+
+To upgrade this module, you need to:
+
+Download the module and add it to your Odoo addons folder. Restart the server
+and log on to your Odoo server. Select the Apps menu and upgrade the module by
+clicking on the upgrade button.
+
+If you installed the module using the "pip" command, you can also update the
+module in the same way. Just type the following command into the console:
+
+``pip install --upgrade --extra-index-url https://nexus.mukit.at/repository/odoo/simple ``
+
+When the process is finished, restart your server and update the application in
+Odoo, just like you would normally.
+
+Configuration
+=============
+
+No additional configuration is needed to use this module.
+
+Usage
+=============
+
+Messages can either be sent via a wizard or directly from the python code either
+via a method in ResUsers or by an entry in the bus system.
+
+Credits
+=======
+
+Contributors
+------------
+
+* Mathias Markl
+
+Images
+------------
+
+Some pictures are based on or inspired by the icon set of Font Awesome:
+
+* `Font Awesome `_
+
+Author & Maintainer
+-------------------
+
+This module is maintained by the `MuK IT GmbH `_.
+
+MuK IT is an Austrian company specialized in customizing and extending Odoo.
+We develop custom solutions for your individual needs to help you focus on
+your strength and expertise to grow your business.
+
+If you want to get in touch please contact us via mail
+(sale@mukit.at) or visit our website (https://mukit.at).
diff --git a/muk_web_client_notification/models/__init__.py b/muk_web_client_notification/models/__init__.py
index cd236c2..169f0fc 100644
--- a/muk_web_client_notification/models/__init__.py
+++ b/muk_web_client_notification/models/__init__.py
@@ -1,6 +1,9 @@
###################################################################################
#
-# Copyright (C) 2017 MuK IT GmbH
+# Copyright (c) 2017-2019 MuK IT GmbH.
+#
+# This file is part of MuK Web Notification
+# (see https://mukit.at).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -13,7 +16,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
+# along with this program. If not, see .
#
###################################################################################
diff --git a/muk_web_client_notification/models/bus.py b/muk_web_client_notification/models/bus.py
index 424da66..cb28d29 100644
--- a/muk_web_client_notification/models/bus.py
+++ b/muk_web_client_notification/models/bus.py
@@ -1,6 +1,9 @@
###################################################################################
#
-# Copyright (C) 2017 MuK IT GmbH
+# Copyright (c) 2017-2019 MuK IT GmbH.
+#
+# This file is part of MuK Web Notification
+# (see https://mukit.at).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -13,7 +16,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
+# along with this program. If not, see .
#
###################################################################################
diff --git a/muk_web_client_notification/models/res_users.py b/muk_web_client_notification/models/res_users.py
index f245c49..45c5fe1 100644
--- a/muk_web_client_notification/models/res_users.py
+++ b/muk_web_client_notification/models/res_users.py
@@ -1,6 +1,9 @@
###################################################################################
#
-# Copyright (C) 2017 MuK IT GmbH
+# Copyright (c) 2017-2019 MuK IT GmbH.
+#
+# This file is part of MuK Web Notification
+# (see https://mukit.at).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -13,7 +16,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
+# along with this program. If not, see .
#
###################################################################################
diff --git a/muk_web_client_notification/static/src/js/client_notification.js b/muk_web_client_notification/static/src/js/client_notification.js
index 84815c4..7e6ad5e 100644
--- a/muk_web_client_notification/static/src/js/client_notification.js
+++ b/muk_web_client_notification/static/src/js/client_notification.js
@@ -1,6 +1,9 @@
/**********************************************************************************
-*
-* Copyright (C) 2017 MuK IT GmbH
+*
+* Copyright (c) 2017-2019 MuK IT GmbH.
+*
+* This file is part of MuK Web Notification
+* (see https://mukit.at).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
@@ -13,7 +16,7 @@
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
-* along with this program. If not, see .
+* along with this program. If not, see .
*
**********************************************************************************/
diff --git a/muk_web_client_notification/template/assets.xml b/muk_web_client_notification/template/assets.xml
index 7642002..f30cf17 100644
--- a/muk_web_client_notification/template/assets.xml
+++ b/muk_web_client_notification/template/assets.xml
@@ -1,8 +1,12 @@
-
+ along with this program. If not, see .
+
+ -->
diff --git a/muk_web_client_notification/views/res_config_settings_view.xml b/muk_web_client_notification/views/res_config_settings_view.xml
index a89cb38..23c33dd 100644
--- a/muk_web_client_notification/views/res_config_settings_view.xml
+++ b/muk_web_client_notification/views/res_config_settings_view.xml
@@ -1,37 +1,42 @@
-
-
-
-
-
-
-
- res.config.settings.view.form
- res.config.settings
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ res.config.settings.view.form
+ res.config.settings
+
+
+
+
+
+
+
+
diff --git a/muk_web_client_notification/views/send_notifications.xml b/muk_web_client_notification/views/send_notifications.xml
index 41fe9c6..2bc0817 100644
--- a/muk_web_client_notification/views/send_notifications.xml
+++ b/muk_web_client_notification/views/send_notifications.xml
@@ -1,68 +1,73 @@
-
-
-
-
-
-
-
- Send Notifications
- muk_web_client_notification.send_notifications
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ Send Notifications
+ muk_web_client_notification.send_notifications
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/muk_web_client_notification/wizards/__init__.py b/muk_web_client_notification/wizards/__init__.py
index 6e7360e..9aecfed 100644
--- a/muk_web_client_notification/wizards/__init__.py
+++ b/muk_web_client_notification/wizards/__init__.py
@@ -1,6 +1,9 @@
###################################################################################
#
-# Copyright (C) 2017 MuK IT GmbH
+# Copyright (c) 2017-2019 MuK IT GmbH.
+#
+# This file is part of MuK Web Notification
+# (see https://mukit.at).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -13,7 +16,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
+# along with this program. If not, see .
#
###################################################################################
diff --git a/muk_web_client_notification/wizards/send_notifications.py b/muk_web_client_notification/wizards/send_notifications.py
index 8a2c79f..ab0a9d8 100644
--- a/muk_web_client_notification/wizards/send_notifications.py
+++ b/muk_web_client_notification/wizards/send_notifications.py
@@ -1,99 +1,102 @@
-###################################################################################
-#
-# Copyright (C) 2017 MuK IT GmbH
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see .
-#
-###################################################################################
-
-import logging
-
-from odoo import _, api, fields, models
-
-_logger = logging.getLogger(__name__)
-
-class NotifyWizard(models.TransientModel):
-
- _name = "muk_web_client_notification.send_notifications"
-
- def _default_user_ids(self):
- user_ids = self._context.get('active_model') == 'res.users' and self._context.get('active_ids') or []
- return [(6, 0, user_ids)]
-
- user_ids = fields.Many2many(
- comodel_name='res.users',
- relation='muk_web_client_notification_user_rel',
- column1='wizard_id',
- column2='user_id',
- string='Users',
- default=_default_user_ids,
- help="If no user is selected, the message is sent globally to all users.")
-
- type = fields.Selection(
- selection=[('info', 'Information'), ('warning', 'Warning')],
- string='Type',
- required=True,
- default='info')
-
- title = fields.Char(
- string="Title",
- required=True)
-
- message = fields.Text(
- string="Message",
- required=True)
-
- sticky = fields.Boolean(
- string="Sticky")
-
- action_id = fields.Many2one(
- comodel_name='ir.actions.act_window',
- string='Action',
- help="If an action is set a button to call it is added to the notification.")
-
- close = fields.Boolean(
- string="Close",
- default=True)
-
- @api.multi
- def send_notifications(self):
- for record in self:
- params = {
- 'type': record.type,
- 'title': record.title,
- 'message': record.message,
- 'sticky': record.sticky,
- }
- if record.action_id.exists():
- buttons = [{
- 'text': _("Action"),
- 'primary': True,
- 'action': record.action_id.id,
- }]
- if record.close:
- buttons.append({
- 'text': _("Close"),
- 'primary': False,
- 'action': None,
- })
- params.update({'buttons': buttons})
- record.user_ids.notify(**params)
- return {
- 'type': 'ir.actions.act_window_close'
- }
-
- @api.onchange('action_id')
- def check_change(self):
- if self.action_id:
+###################################################################################
+#
+# Copyright (c) 2017-2019 MuK IT GmbH.
+#
+# This file is part of MuK Web Notification
+# (see https://mukit.at).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+###################################################################################
+
+import logging
+
+from odoo import _, api, fields, models
+
+_logger = logging.getLogger(__name__)
+
+class NotifyWizard(models.TransientModel):
+
+ _name = "muk_web_client_notification.send_notifications"
+
+ def _default_user_ids(self):
+ user_ids = self._context.get('active_model') == 'res.users' and self._context.get('active_ids') or []
+ return [(6, 0, user_ids)]
+
+ user_ids = fields.Many2many(
+ comodel_name='res.users',
+ relation='muk_web_client_notification_user_rel',
+ column1='wizard_id',
+ column2='user_id',
+ string='Users',
+ default=_default_user_ids,
+ help="If no user is selected, the message is sent globally to all users.")
+
+ type = fields.Selection(
+ selection=[('info', 'Information'), ('warning', 'Warning')],
+ string='Type',
+ required=True,
+ default='info')
+
+ title = fields.Char(
+ string="Title",
+ required=True)
+
+ message = fields.Text(
+ string="Message",
+ required=True)
+
+ sticky = fields.Boolean(
+ string="Sticky")
+
+ action_id = fields.Many2one(
+ comodel_name='ir.actions.act_window',
+ string='Action',
+ help="If an action is set a button to call it is added to the notification.")
+
+ close = fields.Boolean(
+ string="Close",
+ default=True)
+
+ @api.multi
+ def send_notifications(self):
+ for record in self:
+ params = {
+ 'type': record.type,
+ 'title': record.title,
+ 'message': record.message,
+ 'sticky': record.sticky,
+ }
+ if record.action_id.exists():
+ buttons = [{
+ 'text': _("Action"),
+ 'primary': True,
+ 'action': record.action_id.id,
+ }]
+ if record.close:
+ buttons.append({
+ 'text': _("Close"),
+ 'primary': False,
+ 'action': None,
+ })
+ params.update({'buttons': buttons})
+ record.user_ids.notify(**params)
+ return {
+ 'type': 'ir.actions.act_window_close'
+ }
+
+ @api.onchange('action_id')
+ def check_change(self):
+ if self.action_id:
self.sticky = True
\ No newline at end of file