diff --git a/web_notify/__manifest__.py b/web_notify/__manifest__.py index 858c3be99..9b152fe6f 100644 --- a/web_notify/__manifest__.py +++ b/web_notify/__manifest__.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2016 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). @@ -6,7 +5,7 @@ 'name': 'Web Notify', 'summary': """ Send notification messages to user""", - 'version': '10.0.1.0.0', + 'version': '11.0.1.0.0', 'description': 'Web Notify', 'license': 'AGPL-3', 'author': 'ACSONE SA/NV,Odoo Community Association (OCA)', diff --git a/web_notify/i18n/de.po b/web_notify/i18n/de.po index bb2bbe587..4cbcc8771 100644 --- a/web_notify/i18n/de.po +++ b/web_notify/i18n/de.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: # * web_notify -# +# # Translators: # Niki Waibel , 2017 msgid "" @@ -12,26 +12,28 @@ msgstr "" "PO-Revision-Date: 2017-02-03 01:37+0000\n" "Last-Translator: Niki Waibel , 2017\n" "Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n" +"Language: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: de\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #. module: web_notify -#: code:addons/web_notify/models/res_users.py:27 +#: code:addons/web_notify/models/res_users.py:26 #, python-format msgid "Information" msgstr "Information" #. module: web_notify #: model:ir.model.fields,field_description:web_notify.field_res_users_notify_info_channel_name -msgid "Notify info channel name" +#, fuzzy +msgid "Notify Info Channel Name" msgstr "Name des Informationen-Kanals" #. module: web_notify #: model:ir.model.fields,field_description:web_notify.field_res_users_notify_warning_channel_name -msgid "Notify warning channel name" +#, fuzzy +msgid "Notify Warning Channel Name" msgstr "Name des Warnungen-Kanals" #. module: web_notify @@ -40,7 +42,7 @@ msgid "Users" msgstr "Benutzer" #. module: web_notify -#: code:addons/web_notify/models/res_users.py:33 +#: code:addons/web_notify/models/res_users.py:32 #, python-format msgid "Warning" msgstr "Warnung" diff --git a/web_notify/i18n/es.po b/web_notify/i18n/es.po index 6b7649c42..0775ce561 100644 --- a/web_notify/i18n/es.po +++ b/web_notify/i18n/es.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: # * web_notify -# +# # Translators: # Pedro M. Baeza , 2016 msgid "" @@ -12,26 +12,28 @@ msgstr "" "PO-Revision-Date: 2016-12-23 02:13+0000\n" "Last-Translator: Pedro M. Baeza , 2016\n" "Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n" +"Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: es\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #. module: web_notify -#: code:addons/web_notify/models/res_users.py:27 +#: code:addons/web_notify/models/res_users.py:26 #, python-format msgid "Information" msgstr "Información" #. module: web_notify #: model:ir.model.fields,field_description:web_notify.field_res_users_notify_info_channel_name -msgid "Notify info channel name" +#, fuzzy +msgid "Notify Info Channel Name" msgstr "Nombre del canal de información notificada" #. module: web_notify #: model:ir.model.fields,field_description:web_notify.field_res_users_notify_warning_channel_name -msgid "Notify warning channel name" +#, fuzzy +msgid "Notify Warning Channel Name" msgstr "Nombre del canal de avisos notificados" #. module: web_notify @@ -40,7 +42,7 @@ msgid "Users" msgstr "Usuarios" #. module: web_notify -#: code:addons/web_notify/models/res_users.py:33 +#: code:addons/web_notify/models/res_users.py:32 #, python-format msgid "Warning" msgstr "Aviso" diff --git a/web_notify/i18n/hr.po b/web_notify/i18n/hr.po index a67571f68..036b55505 100644 --- a/web_notify/i18n/hr.po +++ b/web_notify/i18n/hr.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: # * web_notify -# +# # Translators: # Bole , 2017 msgid "" @@ -12,26 +12,29 @@ msgstr "" "PO-Revision-Date: 2017-04-28 18:03+0000\n" "Last-Translator: Bole , 2017\n" "Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n" +"Language: hr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: hr\n" -"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" #. module: web_notify -#: code:addons/web_notify/models/res_users.py:27 +#: code:addons/web_notify/models/res_users.py:26 #, python-format msgid "Information" msgstr "Informacija" #. module: web_notify #: model:ir.model.fields,field_description:web_notify.field_res_users_notify_info_channel_name -msgid "Notify info channel name" +#, fuzzy +msgid "Notify Info Channel Name" msgstr "Naziv kanala informacija" #. module: web_notify #: model:ir.model.fields,field_description:web_notify.field_res_users_notify_warning_channel_name -msgid "Notify warning channel name" +#, fuzzy +msgid "Notify Warning Channel Name" msgstr "Naziv kanala upozorenja" #. module: web_notify @@ -40,7 +43,7 @@ msgid "Users" msgstr "Korisnici" #. module: web_notify -#: code:addons/web_notify/models/res_users.py:33 +#: code:addons/web_notify/models/res_users.py:32 #, python-format msgid "Warning" msgstr "Upozorenje" diff --git a/web_notify/i18n/nl_NL.po b/web_notify/i18n/nl_NL.po index 8071f2ad9..289ed1db5 100644 --- a/web_notify/i18n/nl_NL.po +++ b/web_notify/i18n/nl_NL.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: # * web_notify -# +# # Translators: # Peter Hageman , 2017 msgid "" @@ -11,27 +11,28 @@ msgstr "" "POT-Creation-Date: 2017-07-13 16:07+0000\n" "PO-Revision-Date: 2017-07-13 16:07+0000\n" "Last-Translator: Peter Hageman , 2017\n" -"Language-Team: Dutch (Netherlands) (https://www.transifex.com/oca/teams/23907/nl_NL/)\n" +"Language-Team: Dutch (Netherlands) (https://www.transifex.com/oca/" +"teams/23907/nl_NL/)\n" +"Language: nl_NL\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: nl_NL\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #. module: web_notify -#: code:addons/web_notify/models/res_users.py:27 +#: code:addons/web_notify/models/res_users.py:26 #, python-format msgid "Information" msgstr "Informatie" #. module: web_notify #: model:ir.model.fields,field_description:web_notify.field_res_users_notify_info_channel_name -msgid "Notify info channel name" +msgid "Notify Info Channel Name" msgstr "" #. module: web_notify #: model:ir.model.fields,field_description:web_notify.field_res_users_notify_warning_channel_name -msgid "Notify warning channel name" +msgid "Notify Warning Channel Name" msgstr "" #. module: web_notify @@ -40,7 +41,7 @@ msgid "Users" msgstr "Gebruikers" #. module: web_notify -#: code:addons/web_notify/models/res_users.py:33 +#: code:addons/web_notify/models/res_users.py:32 #, python-format msgid "Warning" msgstr "Waarschuwing" diff --git a/web_notify/i18n/pt_BR.po b/web_notify/i18n/pt_BR.po index acaa21b66..fec1d0b87 100644 --- a/web_notify/i18n/pt_BR.po +++ b/web_notify/i18n/pt_BR.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: # * web_notify -# +# # Translators: # Rodrigo de Almeida Sottomaior Macedo , 2017 msgid "" @@ -10,28 +10,32 @@ msgstr "" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2017-06-22 08:27+0000\n" "PO-Revision-Date: 2017-06-22 08:27+0000\n" -"Last-Translator: Rodrigo de Almeida Sottomaior Macedo , 2017\n" -"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/teams/23907/pt_BR/)\n" +"Last-Translator: Rodrigo de Almeida Sottomaior Macedo " +", 2017\n" +"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/" +"teams/23907/pt_BR/)\n" +"Language: pt_BR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: pt_BR\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" #. module: web_notify -#: code:addons/web_notify/models/res_users.py:27 +#: code:addons/web_notify/models/res_users.py:26 #, python-format msgid "Information" msgstr "Informação" #. module: web_notify #: model:ir.model.fields,field_description:web_notify.field_res_users_notify_info_channel_name -msgid "Notify info channel name" +#, fuzzy +msgid "Notify Info Channel Name" msgstr "Notificar o nome do canal de informações" #. module: web_notify #: model:ir.model.fields,field_description:web_notify.field_res_users_notify_warning_channel_name -msgid "Notify warning channel name" +#, fuzzy +msgid "Notify Warning Channel Name" msgstr "Notificar o nome do canal de alerta" #. module: web_notify @@ -40,7 +44,7 @@ msgid "Users" msgstr "Usuários" #. module: web_notify -#: code:addons/web_notify/models/res_users.py:33 +#: code:addons/web_notify/models/res_users.py:32 #, python-format msgid "Warning" msgstr "Alerta" diff --git a/web_notify/i18n/web_notify.pot b/web_notify/i18n/web_notify.pot new file mode 100644 index 000000000..74aa96a9e --- /dev/null +++ b/web_notify/i18n/web_notify.pot @@ -0,0 +1,42 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_notify +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: web_notify +#: code:addons/web_notify/models/res_users.py:26 +#, python-format +msgid "Information" +msgstr "" + +#. module: web_notify +#: model:ir.model.fields,field_description:web_notify.field_res_users_notify_info_channel_name +msgid "Notify Info Channel Name" +msgstr "" + +#. module: web_notify +#: model:ir.model.fields,field_description:web_notify.field_res_users_notify_warning_channel_name +msgid "Notify Warning Channel Name" +msgstr "" + +#. module: web_notify +#: model:ir.model,name:web_notify.model_res_users +msgid "Users" +msgstr "" + +#. module: web_notify +#: code:addons/web_notify/models/res_users.py:32 +#, python-format +msgid "Warning" +msgstr "" + diff --git a/web_notify/models/res_users.py b/web_notify/models/res_users.py index 29f0eca17..82563eae1 100644 --- a/web_notify/models/res_users.py +++ b/web_notify/models/res_users.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # Copyright 2016 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). diff --git a/web_notify/static/src/js/web_client.js b/web_notify/static/src/js/web_client.js index 1ee99224c..739251c87 100644 --- a/web_notify/static/src/js/web_client.js +++ b/web_notify/static/src/js/web_client.js @@ -3,24 +3,18 @@ odoo.define('web_notify.WebClient', function (require) { var WebClient = require('web.WebClient'); var base_bus = require('bus.bus'); +var session = require('web.session'); + WebClient.include({ - init: function(parent, client_options){ - this._super(parent, client_options); - }, show_application: function() { var res = this._super(); this.start_polling(); return res }, - on_logout: function() { - var self = this; - base_bus.bus.off('notification', this, this.bus_notification); - this._super(); - }, start_polling: function() { - this.channel_warning = 'notify_warning_' + this.session.uid; - this.channel_info = 'notify_info_' + this.session.uid; + this.channel_warning = 'notify_warning_' + session.uid; + this.channel_info = 'notify_info_' + session.uid; base_bus.bus.add_channel(this.channel_warning); base_bus.bus.add_channel(this.channel_info); base_bus.bus.on('notification', this, this.bus_notification); @@ -33,7 +27,7 @@ WebClient.include({ var message = notification[1]; if (channel === self.channel_warning) { self.on_message_warning(message); - } else if (channel == self.channel_info) { + } else if (channel === self.channel_info) { self.on_message_info(message); } }); diff --git a/web_notify/tests/test_res_users.py b/web_notify/tests/test_res_users.py index 72416d5e2..80c260423 100644 --- a/web_notify/tests/test_res_users.py +++ b/web_notify/tests/test_res_users.py @@ -1,9 +1,9 @@ -# -*- coding: utf-8 -*- # Copyright 2016 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo.tests import common from odoo.addons.bus.models.bus import json_dump +import json import mock @@ -16,13 +16,11 @@ class TestResUsers(common.TransactionCase): json_dump(self.env.user.notify_info_channel_name)) ] existing = bus_bus.search(domain) - self.env.user.notify_info( - message='message', title='title', sticky=True) + test_msg = {'message': 'message', 'title': 'title', 'sticky': True} + self.env.user.notify_info(**test_msg) news = bus_bus.search(domain) - existing self.assertEqual(1, len(news)) - self.assertEqual( - '{"message":"message","sticky":true,"title":"title"}', - news.message) + self.assertEqual(test_msg, json.loads(news.message)) def test_notify_warning(self): bus_bus = self.env['bus.bus'] @@ -31,13 +29,11 @@ class TestResUsers(common.TransactionCase): json_dump(self.env.user.notify_warning_channel_name)) ] existing = bus_bus.search(domain) - self.env.user.notify_warning( - message='message', title='title', sticky=True) + test_msg = {'message': 'message', 'title': 'title', 'sticky': True} + self.env.user.notify_warning(**test_msg) news = bus_bus.search(domain) - existing self.assertEqual(1, len(news)) - self.assertEqual( - '{"message":"message","sticky":true,"title":"title"}', - news.message) + self.assertEqual(test_msg, json.loads(news.message)) def test_notify_many(self): # check that the notification of a list of users is done with diff --git a/web_notify/views/web_notify.xml b/web_notify/views/web_notify.xml index b85d2e6ff..5dc3795ff 100644 --- a/web_notify/views/web_notify.xml +++ b/web_notify/views/web_notify.xml @@ -1,7 +1,7 @@ -