diff --git a/mail_all/README.rst b/mail_all/README.rst new file mode 100644 index 0000000..17ded40 --- /dev/null +++ b/mail_all/README.rst @@ -0,0 +1,16 @@ +=================== + Show all messages +=================== + +Adds ``Discuss / All`` menu, that shows all messages accesable by current user + +Further information +------------------- + +HTML Description: https://apps.odoo.com/apps/modules/9.0/mail_all/ + +Usage instructions: ``_ + +Changelog: ``_ + +Tested on Odoo 9.0 d3dd4161ad0598ebaa659fbd083457c77aa9448d diff --git a/mail_all/__init__.py b/mail_all/__init__.py new file mode 100644 index 0000000..5305644 --- /dev/null +++ b/mail_all/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import models \ No newline at end of file diff --git a/mail_all/__openerp__.py b/mail_all/__openerp__.py new file mode 100644 index 0000000..6737443 --- /dev/null +++ b/mail_all/__openerp__.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +{ + "name": "Show all messages", + "summary": """Checkout all messages where you have access""", + "category": "Discuss", + "images": [], + "version": "1.0.0", + + "author": "IT-Projects LLC, Pavel Romanchenko", + "website": "https://it-projects.info", + "license": "LGPL-3", + 'price': 40.00, + 'currency': 'EUR', + + "depends": [ + "mail_base" + ], + "external_dependencies": {"python": [], "bin": []}, + "data": [ + "views/templates.xml", + ], + "qweb": [ + "static/src/xml/menu.xml", + ], + "demo": [], + 'installable': True, + "auto_install": False, +} diff --git a/mail_all/doc/changelog.rst b/mail_all/doc/changelog.rst new file mode 100644 index 0000000..e2b0277 --- /dev/null +++ b/mail_all/doc/changelog.rst @@ -0,0 +1,7 @@ +Changelog +========= + +`1.0.0` +------- + +- Init version diff --git a/mail_all/doc/index.rst b/mail_all/doc/index.rst new file mode 100644 index 0000000..30b2245 --- /dev/null +++ b/mail_all/doc/index.rst @@ -0,0 +1,9 @@ +=================== + Show all messages +=================== + +Usage +===== + +* Open menu ``Discuss / All messages`` +* You see all messages diff --git a/mail_all/models/__init__.py b/mail_all/models/__init__.py new file mode 100644 index 0000000..40a96af --- /dev/null +++ b/mail_all/models/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/mail_all/static/description/1.png b/mail_all/static/description/1.png new file mode 100644 index 0000000..c5f0307 Binary files /dev/null and b/mail_all/static/description/1.png differ diff --git a/mail_all/static/description/2.png b/mail_all/static/description/2.png new file mode 100644 index 0000000..c87e750 Binary files /dev/null and b/mail_all/static/description/2.png differ diff --git a/mail_all/static/description/icon.png b/mail_all/static/description/icon.png new file mode 100644 index 0000000..79f7d8f Binary files /dev/null and b/mail_all/static/description/icon.png differ diff --git a/mail_all/static/description/index.html b/mail_all/static/description/index.html new file mode 100644 index 0000000..996fcc7 --- /dev/null +++ b/mail_all/static/description/index.html @@ -0,0 +1,45 @@ +
+
+
+

Show all messages

+

Checkout all messages where you have access

+
+
+
+ +
+
+
+

+ The module adds usual menu. +

+
+
+
+ +
+
+
+

+This menu shows all messages. +

+
+
+ +
+
+
+ +
+
+ +
+
diff --git a/mail_all/static/src/js/mail_all.js b/mail_all/static/src/js/mail_all.js new file mode 100644 index 0000000..ba1cb00 --- /dev/null +++ b/mail_all/static/src/js/mail_all.js @@ -0,0 +1,65 @@ +odoo.define('mail_all.all', function (require) { +"use strict"; + +var base_obj = require('mail_base.base'); + +//------------------------------------------------------------------------------- +var bus = require('bus.bus').bus; +var config = require('web.config'); +var core = require('web.core'); +var data = require('web.data'); +var Model = require('web.Model'); +var session = require('web.session'); +var time = require('web.time'); +var web_client = require('web.web_client'); + +var _lt = core._lt; +//------------------------------------------------------------------------------- + +var ChatAction = core.action_registry.get('mail.chat.instant_messaging'); +ChatAction.include({ + get_thread_rendering_options: function (messages) { + var options = this._super.apply(this, arguments); + options.display_subject = options.display_subject || this.channel.id === "channel_all"; + return options; + } +}); + +// Inherit class and override methods +base_obj.MailTools.include({ + get_properties: function(msg){ + var properties = this._super.apply(this, arguments); + properties.is_all = this.property_descr("channel_all", msg, this); + return properties; + }, + + set_channel_flags: function(data, msg){ + this._super.apply(this, arguments); + msg.is_all = true; + return msg; + }, + + get_channel_array: function(msg){ + var arr = this._super.apply(this, arguments); + return arr.concat('channel_all'); + }, + + get_domain: function(channel){ + return (channel.id === "channel_all") ? [] : this._super.apply(this, arguments); + } +}); + +base_obj.chat_manager.is_ready.then(function(){ + // Add all channel + base_obj.chat_manager.mail_tools.add_channel({ + id: "channel_all", + name: _lt("All messages"), + type: "static" + }); + + return $.when(); + }); + +return base_obj.chat_manager; + +}); diff --git a/mail_all/static/src/xml/menu.xml b/mail_all/static/src/xml/menu.xml new file mode 100644 index 0000000..8ad1bcb --- /dev/null +++ b/mail_all/static/src/xml/menu.xml @@ -0,0 +1,19 @@ + + diff --git a/mail_all/tests/__init__.py b/mail_all/tests/__init__.py new file mode 100644 index 0000000..6731bb9 --- /dev/null +++ b/mail_all/tests/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +import test_js \ No newline at end of file diff --git a/mail_all/tests/test_js.py b/mail_all/tests/test_js.py new file mode 100644 index 0000000..5c62a58 --- /dev/null +++ b/mail_all/tests/test_js.py @@ -0,0 +1,15 @@ +import openerp.tests + +@openerp.tests.common.at_install(False) +@openerp.tests.common.post_install(True) +class TestUi(openerp.tests.HttpCase): + def test_01_mail_all(self): + # wait till page loaded and then click and wait again + code = """ + setTimeout(function () { + $(".mail_all").click(); + setTimeout(function () {console.log('ok');}, 3000); + }, 1000); + """ + link = '/web#action=%s' % self.ref('mail.mail_channel_action_client_chat') + self.phantom_js(link, code, "odoo.__DEBUG__.services['mail_all.all']", login="admin") diff --git a/mail_all/views/templates.xml b/mail_all/views/templates.xml new file mode 100644 index 0000000..7ca724f --- /dev/null +++ b/mail_all/views/templates.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/res_partner_mails_count/__openerp__.py b/res_partner_mails_count/__openerp__.py index 5d39403..e2ca849 100644 --- a/res_partner_mails_count/__openerp__.py +++ b/res_partner_mails_count/__openerp__.py @@ -13,8 +13,8 @@ "currency": "EUR", "depends": [ - 'mail_archives', - 'web_tour_extra' , + 'mail_all', + 'web_tour_extra', ], "external_dependencies": {"python": [], "bin": []}, "data": [ diff --git a/res_partner_mails_count/views/res_partner_mails_count.xml b/res_partner_mails_count/views/res_partner_mails_count.xml index 7b328d8..7ef9960 100644 --- a/res_partner_mails_count/views/res_partner_mails_count.xml +++ b/res_partner_mails_count/views/res_partner_mails_count.xml @@ -6,7 +6,7 @@ mail.chat.instant_messaging mail.message { - 'active_id': 'channel_archive' + 'active_id': 'channel_all' }