MuK IT GmbH
5 years ago
13 changed files with 491 additions and 452 deletions
-
228muk_web_client_notification/README.rst
-
7muk_web_client_notification/__init__.py
-
11muk_web_client_notification/__manifest__.py
-
228muk_web_client_notification/doc/index.rst
-
7muk_web_client_notification/models/__init__.py
-
7muk_web_client_notification/models/bus.py
-
7muk_web_client_notification/models/res_users.py
-
9muk_web_client_notification/static/src/js/client_notification.js
-
15muk_web_client_notification/template/assets.xml
-
79muk_web_client_notification/views/res_config_settings_view.xml
-
139muk_web_client_notification/views/send_notifications.xml
-
7muk_web_client_notification/wizards/__init__.py
-
199muk_web_client_notification/wizards/send_notifications.py
@ -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 <https://pypi.org/project/pip/>`_). |
|||
|
|||
To install our modules using the package manager make sure |
|||
`odoo-autodiscover <https://pypi.org/project/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 <module>`` |
|||
|
|||
The module name consists of the Odoo version and the module name, where |
|||
underscores are replaced by a dash. |
|||
|
|||
**Module:** |
|||
|
|||
``odoo<version>-addon-<module_name>`` |
|||
|
|||
**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 <module>`` |
|||
|
|||
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 <https://nexus.mukit.at/#browse/browse:odoo>`_ |
|||
and find a more detailed installation guide on our `website <https://mukit.at/page/open-source>`_. |
|||
|
|||
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 <https://www.mukit.at/>`_ 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 <module>`` |
|||
|
|||
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 <mathias.markl@mukit.at> |
|||
|
|||
Images |
|||
------------ |
|||
|
|||
Some pictures are based on or inspired by the icon set of Font Awesome: |
|||
|
|||
* `Font Awesome <https://fontawesome.com>`_ |
|||
|
|||
Author & Maintainer |
|||
------------------- |
|||
|
|||
This module is maintained by the `MuK IT GmbH <https://www.mukit.at/>`_. |
|||
|
|||
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 <https://pypi.org/project/pip/>`_). |
|||
|
|||
To install our modules using the package manager make sure |
|||
`odoo-autodiscover <https://pypi.org/project/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 <module>`` |
|||
|
|||
The module name consists of the Odoo version and the module name, where |
|||
underscores are replaced by a dash. |
|||
|
|||
**Module:** |
|||
|
|||
``odoo<version>-addon-<module_name>`` |
|||
|
|||
**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 <module>`` |
|||
|
|||
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 <https://nexus.mukit.at/#browse/browse:odoo>`_ |
|||
and find a more detailed installation guide on our `website <https://mukit.at/page/open-source>`_. |
|||
|
|||
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 <https://www.mukit.at/>`_ 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 <module>`` |
|||
|
|||
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 <mathias.markl@mukit.at> |
|||
|
|||
Images |
|||
------------ |
|||
|
|||
Some pictures are based on or inspired by the icon set of Font Awesome: |
|||
|
|||
* `Font Awesome <https://fontawesome.com>`_ |
|||
|
|||
Author & Maintainer |
|||
------------------- |
|||
|
|||
This module is maintained by the `MuK IT GmbH <https://www.mukit.at/>`_. |
|||
|
|||
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). |
@ -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 <https://pypi.org/project/pip/>`_). |
|||
|
|||
To install our modules using the package manager make sure |
|||
`odoo-autodiscover <https://pypi.org/project/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 <module>`` |
|||
|
|||
The module name consists of the Odoo version and the module name, where |
|||
underscores are replaced by a dash. |
|||
|
|||
**Module:** |
|||
|
|||
``odoo<version>-addon-<module_name>`` |
|||
|
|||
**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 <module>`` |
|||
|
|||
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 <https://nexus.mukit.at/#browse/browse:odoo>`_ |
|||
and find a more detailed installation guide on our `website <https://mukit.at/page/open-source>`_. |
|||
|
|||
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 <https://www.mukit.at/>`_ 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 <module>`` |
|||
|
|||
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 <mathias.markl@mukit.at> |
|||
|
|||
Images |
|||
------------ |
|||
|
|||
Some pictures are based on or inspired by the icon set of Font Awesome: |
|||
|
|||
* `Font Awesome <https://fontawesome.com>`_ |
|||
|
|||
Author & Maintainer |
|||
------------------- |
|||
|
|||
This module is maintained by the `MuK IT GmbH <https://www.mukit.at/>`_. |
|||
|
|||
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 <https://pypi.org/project/pip/>`_). |
|||
|
|||
To install our modules using the package manager make sure |
|||
`odoo-autodiscover <https://pypi.org/project/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 <module>`` |
|||
|
|||
The module name consists of the Odoo version and the module name, where |
|||
underscores are replaced by a dash. |
|||
|
|||
**Module:** |
|||
|
|||
``odoo<version>-addon-<module_name>`` |
|||
|
|||
**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 <module>`` |
|||
|
|||
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 <https://nexus.mukit.at/#browse/browse:odoo>`_ |
|||
and find a more detailed installation guide on our `website <https://mukit.at/page/open-source>`_. |
|||
|
|||
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 <https://www.mukit.at/>`_ 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 <module>`` |
|||
|
|||
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 <mathias.markl@mukit.at> |
|||
|
|||
Images |
|||
------------ |
|||
|
|||
Some pictures are based on or inspired by the icon set of Font Awesome: |
|||
|
|||
* `Font Awesome <https://fontawesome.com>`_ |
|||
|
|||
Author & Maintainer |
|||
------------------- |
|||
|
|||
This module is maintained by the `MuK IT GmbH <https://www.mukit.at/>`_. |
|||
|
|||
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). |
@ -1,37 +1,42 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
|
|||
<!-- |
|||
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 <http://www.gnu.org/licenses/>. |
|||
--> |
|||
|
|||
<odoo> |
|||
|
|||
<record id="res_config_settings_view_form" model="ir.ui.view"> |
|||
<field name="name">res.config.settings.view.form</field> |
|||
<field name="model">res.config.settings</field> |
|||
<field name="inherit_id" ref="base_setup.res_config_settings_view_form"/> |
|||
<field name="arch" type="xml"> |
|||
<div id="msg_module_muk_web_client_notification" position="replace"> |
|||
<div class="content-group" attrs="{'invisible': [('module_muk_web_client_notification','=',False)]}"> |
|||
<button name="%(muk_web_client_notification.act_send_notifications)d" |
|||
string="Notify Users" type="action" class="oe_link" icon="fa-arrow-right"/> |
|||
</div> |
|||
</div> |
|||
</field> |
|||
</record> |
|||
|
|||
</odoo> |
|||
|
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
|
|||
<!-- |
|||
|
|||
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 <http://www.gnu.org/licenses/>. |
|||
|
|||
--> |
|||
|
|||
<odoo> |
|||
|
|||
<record id="res_config_settings_view_form" model="ir.ui.view"> |
|||
<field name="name">res.config.settings.view.form</field> |
|||
<field name="model">res.config.settings</field> |
|||
<field name="inherit_id" ref="base_setup.res_config_settings_view_form"/> |
|||
<field name="arch" type="xml"> |
|||
<div id="msg_module_muk_web_client_notification" position="replace"> |
|||
<div class="content-group" attrs="{'invisible': [('module_muk_web_client_notification','=',False)]}"> |
|||
<button name="%(muk_web_client_notification.act_send_notifications)d" |
|||
string="Notify Users" type="action" class="oe_link" icon="fa-arrow-right"/> |
|||
</div> |
|||
</div> |
|||
</field> |
|||
</record> |
|||
|
|||
</odoo> |
|||
|
@ -1,68 +1,73 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
|
|||
<!-- |
|||
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 <http://www.gnu.org/licenses/>. |
|||
--> |
|||
|
|||
<odoo> |
|||
|
|||
<record id="send_notifications_view_form" model="ir.ui.view"> |
|||
<field name="name">Send Notifications</field> |
|||
<field name="model">muk_web_client_notification.send_notifications</field> |
|||
<field name="arch" type="xml"> |
|||
<form string="Send Notifications"> |
|||
<div class="oe_title"> |
|||
<label for="title" class="oe_edit_only"/> |
|||
<h1> |
|||
<field name="title" /> |
|||
</h1> |
|||
</div> |
|||
<group> |
|||
<field name="user_ids" widget="many2many_tags" options="{'no_create_edit': True}" /> |
|||
</group> |
|||
<group> |
|||
<group> |
|||
<field name="type" /> |
|||
<field name="action_id" /> |
|||
</group> |
|||
<group> |
|||
<field name="sticky" attrs="{'readonly': [('action_id', '!=', False)]}" /> |
|||
<field name="close" attrs="{'invisible': [('action_id', '=', False)]}" /> |
|||
</group> |
|||
</group> |
|||
<label for="message" class="oe_edit_only"/> |
|||
<field name="message" /> |
|||
<footer> |
|||
<button string="Send" name="send_notifications" type="object" |
|||
class="btn-primary" /> |
|||
<button string="Cancel" class="btn-default" special="cancel" /> |
|||
</footer> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
|
|||
<act_window |
|||
id="act_send_notifications" |
|||
name="Send Notifications" |
|||
src_model="res.users" |
|||
res_model="muk_web_client_notification.send_notifications" |
|||
view_type="form" |
|||
view_mode="form" |
|||
target="new" |
|||
key2="client_action_multi" |
|||
groups="base.group_erp_manager"/> |
|||
|
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
|
|||
<!-- |
|||
|
|||
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 <http://www.gnu.org/licenses/>. |
|||
|
|||
--> |
|||
|
|||
<odoo> |
|||
|
|||
<record id="send_notifications_view_form" model="ir.ui.view"> |
|||
<field name="name">Send Notifications</field> |
|||
<field name="model">muk_web_client_notification.send_notifications</field> |
|||
<field name="arch" type="xml"> |
|||
<form string="Send Notifications"> |
|||
<div class="oe_title"> |
|||
<label for="title" class="oe_edit_only"/> |
|||
<h1> |
|||
<field name="title" /> |
|||
</h1> |
|||
</div> |
|||
<group> |
|||
<field name="user_ids" widget="many2many_tags" options="{'no_create_edit': True}" /> |
|||
</group> |
|||
<group> |
|||
<group> |
|||
<field name="type" /> |
|||
<field name="action_id" /> |
|||
</group> |
|||
<group> |
|||
<field name="sticky" attrs="{'readonly': [('action_id', '!=', False)]}" /> |
|||
<field name="close" attrs="{'invisible': [('action_id', '=', False)]}" /> |
|||
</group> |
|||
</group> |
|||
<label for="message" class="oe_edit_only"/> |
|||
<field name="message" /> |
|||
<footer> |
|||
<button string="Send" name="send_notifications" type="object" |
|||
class="btn-primary" /> |
|||
<button string="Cancel" class="btn-default" special="cancel" /> |
|||
</footer> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
|
|||
<act_window |
|||
id="act_send_notifications" |
|||
name="Send Notifications" |
|||
src_model="res.users" |
|||
res_model="muk_web_client_notification.send_notifications" |
|||
view_type="form" |
|||
view_mode="form" |
|||
target="new" |
|||
key2="client_action_multi" |
|||
groups="base.group_erp_manager"/> |
|||
|
|||
</odoo> |
@ -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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################### |
|||
|
|||
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 <http://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################### |
|||
|
|||
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 |
Write
Preview
Loading…
Cancel
Save
Reference in new issue