diff --git a/mail_to/README.rst b/mail_to/README.rst index 94c93ff..610d496 100644 --- a/mail_to/README.rst +++ b/mail_to/README.rst @@ -19,7 +19,7 @@ Maintainers ----------- * `IT-Projects LLC `__ - To get a guaranteed support you are kindly requested to purchase the module at `odoo apps store `__. + To get a guaranteed support you are kindly requested to purchase the module at `odoo apps store `__. Thank you for understanding! @@ -28,12 +28,12 @@ Maintainers Further information =================== -Demo: http://runbot.it-projects.info/demo/mail-addons/11.0 +Demo: http://runbot.it-projects.info/demo/mail-addons/12.0 -HTML Description: https://apps.odoo.com/apps/modules/11.0/mail_to/ +HTML Description: https://apps.odoo.com/apps/modules/12.0/mail_to/ Usage instructions: ``_ Changelog: ``_ -Tested on Odoo 11.0 ecbf7aa4714479229658d14cce28fa00376ed390 +Tested on Odoo 12.0 3c40d732bf03c8b656ab170319425f02fddfb2f4 diff --git a/mail_to/__manifest__.py b/mail_to/__manifest__.py index aa2f6c6..18a2815 100644 --- a/mail_to/__manifest__.py +++ b/mail_to/__manifest__.py @@ -3,7 +3,7 @@ "summary": """Allows you be sure, that all discussion participants were notified""", "category": "Discuss", "images": ['images/1.png'], - "version": "11.0.1.0.1", + "version": "12.0.1.0.1", "author": "IT-Projects LLC, Pavel Romanchenko", "support": "apps@it-projects.info", @@ -13,7 +13,7 @@ "currency": "EUR", "depends": [ - 'mail_base', + 'mail', ], "external_dependencies": {"python": [], "bin": []}, "data": [ @@ -23,6 +23,6 @@ 'static/src/xml/recipient.xml', ], "demo": [], - "installable": False, + "installable": True, "auto_install": False, } diff --git a/mail_to/static/description/index.html b/mail_to/static/description/index.html index 544326d..55d8bf9 100644 --- a/mail_to/static/description/index.html +++ b/mail_to/static/description/index.html @@ -41,7 +41,7 @@ -o-transform: rotate(5deg); -moz-transform: rotate(5deg); -ms-transform: rotate(5deg);"> - Tested on Odoo
10.0 community + Tested on Odoo
12.0 community
- Tested on Odoo
10.0 enterprise + Tested on Odoo
12.0 enterprise
diff --git a/mail_to/static/src/js/mail_to.js b/mail_to/static/src/js/mail_to.js deleted file mode 100644 index 8e812a2..0000000 --- a/mail_to/static/src/js/mail_to.js +++ /dev/null @@ -1,30 +0,0 @@ -odoo.define('mail_to.MailTo', function (require) { - "use strict"; - -var chat_manager = require('mail_base.base').chat_manager; - -var make_message_super = chat_manager.make_message; -chat_manager.make_message = function (data) { - var msg = make_message_super.call(this, data); - msg.partner_ids = data.partner_ids; - if (!msg.partner_ids) { - return msg; - } - var more_recipients = ''; - // value which define more recipients - msg.more_recipients_value = 4; - for (var i = 0; i < msg.partner_ids.length; i++) { - if (i >= msg.more_recipients_value) { - // append names - more_recipients += msg.partner_ids[i][1]; - // separate them with semicolon - if (i < msg.partner_ids.length - 1){ - more_recipients += '; '; - } - } - } - msg.more_recipients = more_recipients; - return msg; -}; - return chat_manager; -}); diff --git a/mail_to/static/src/xml/recipient.xml b/mail_to/static/src/xml/recipient.xml index 3b5a50f..832deb2 100644 --- a/mail_to/static/src/xml/recipient.xml +++ b/mail_to/static/src/xml/recipient.xml @@ -1,22 +1,28 @@ diff --git a/mail_to/templates.xml b/mail_to/templates.xml index 24b067a..0d18f81 100644 --- a/mail_to/templates.xml +++ b/mail_to/templates.xml @@ -6,7 +6,6 @@ inherit_id="web.assets_backend"> - diff --git a/mail_to/tests/test_default.py b/mail_to/tests/test_default.py index 99764c6..370b5f2 100644 --- a/mail_to/tests/test_default.py +++ b/mail_to/tests/test_default.py @@ -1,18 +1,46 @@ import odoo.tests +from werkzeug import url_encode -@odoo.tests.common.at_install(False) +@odoo.tests.common.at_install(True) @odoo.tests.common.post_install(True) class TestUi(odoo.tests.HttpCase): def test_01_mail_to(self): # checks the presence of an element with a link to the recipient - # TODO: instead of timeout, try to put $('a.recipient_link') as ready argument of phantom_js (third parameter) + + env = self.env + # needed because tests are run before the module is marked as + # installed. In js web will only load qweb coming from modules + # that are returned by the backend in module_boot. Without + # this you end up with js, css but no qweb. + env['ir.module.module'].search([('name', '=', 'mail_to')], limit=1).state = 'installed' + + # Handle messages in Odoo + res_users_ids = env['res.users'].search([]) + res_users_ids.write({'notification_type': 'inbox'}) + + # demo messages + partner_ids = env['res.partner'].search([]) + msg = env['mail.message'].create({ + 'subject': '_Test', + 'body': self._testMethodName, + 'subtype_id': self.ref('mail.mt_comment'), + 'model': 'mail.channel', + 'partner_ids': [(6, 0, [i.id for i in partner_ids])], + }) + # notifications for everyone + for p in partner_ids.ids: + env['mail.notification'].create({ + 'res_partner_id': p, + 'mail_message_id': msg.id, + 'is_read': False, + }) code = """ setTimeout(function () { - $('a.recipient_link')[0].click(); - console.log('ok'); - }, 1000); + console.log($('a.recipient_link').length && 'ok' || 'error'); + }, 3000); """ - link = '/web#action=%s' % self.ref('mail.mail_channel_action_client_chat') - self.phantom_js(link, code, "odoo.__DEBUG__.services['mail_to.MailTo']", login="admin") + + link = '/web#%s' % url_encode({'action': 'mail.action_discuss'}) + self.phantom_js(link, code, "odoo.__DEBUG__.services['web_tour.tour'].tours.mail_tour.ready", login="admin")