diff --git a/mail_all/README.rst b/mail_all/README.rst index d0b7702..30b1507 100644 --- a/mail_all/README.rst +++ b/mail_all/README.rst @@ -1,8 +1,12 @@ +.. image:: https://img.shields.io/badge/license-LGPL--3-blue.png + :target: https://www.gnu.org/licenses/lgpl + :alt: License: LGPL-3 + =================== Show all messages =================== -Adds ``Discuss / All`` menu, that shows all messages accesable by current user. +Adds ``Discuss / All`` menu, that shows all messages accessible by current user. Credits ======= @@ -36,4 +40,4 @@ Usage instructions: ``_ Changelog: ``_ -Tested on Odoo 11.0 ecbf7aa4714479229658d14cce28fa00376ed390 +Tested on Odoo 12.0 80cef9e8c52ff7dc0715a7478a2288d3de7065df diff --git a/mail_all/__init__.py b/mail_all/__init__.py index e69de29..ca03eda 100644 --- a/mail_all/__init__.py +++ b/mail_all/__init__.py @@ -0,0 +1 @@ +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). diff --git a/mail_all/__openerp__.py b/mail_all/__manifest__.py similarity index 66% rename from mail_all/__openerp__.py rename to mail_all/__manifest__.py index fd0ab55..984904c 100644 --- a/mail_all/__openerp__.py +++ b/mail_all/__manifest__.py @@ -1,10 +1,14 @@ +# Copyright 2016-2018 Ivan Yelizariev +# Copyright 2017-2018 Artyom Losev +# Copyright 2018 Kolushov Alexandr +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). { "name": "Show all messages", "summary": """Checkout all messages where you have access""", "category": "Discuss", # "live_test_url": "", "images": ['images/1.jpg'], - "version": "11.0.1.0.0", + "version": "12.0.1.0.0", "application": False, "author": "IT-Projects LLC, Pavel Romanchenko", @@ -15,7 +19,7 @@ 'currency': 'EUR', "depends": [ - "mail_base" + "mail" ], "external_dependencies": {"python": [], "bin": []}, "data": [ @@ -31,6 +35,6 @@ "post_init_hook": None, "uninstall_hook": None, - 'installable': False, + 'installable': True, "auto_install": False, } diff --git a/mail_all/static/description/index.html b/mail_all/static/description/index.html index 58a5857..291e931 100644 --- a/mail_all/static/description/index.html +++ b/mail_all/static/description/index.html @@ -59,9 +59,9 @@ This menu shows all messages. -o-transform: rotate(6deg); -moz-transform: rotate(6deg); -ms-transform: rotate(6deg);"> - Tested on Odoo
10.0 community + Tested on Odoo
12.0 community -
- Tested on Odoo
10.0 enterprise -
+ -webkit-transform: rotate(-3deg); + -o-transform: rotate(-3deg); + -moz-transform: rotate(-3deg); + -ms-transform: rotate(-3deg);"> + Tested on Odoo
12.0 enterprise + --> diff --git a/mail_all/static/src/js/mail_all.js b/mail_all/static/src/js/mail_all.js index 1873f9e..a0f9bb9 100644 --- a/mail_all/static/src/js/mail_all.js +++ b/mail_all/static/src/js/mail_all.js @@ -1,57 +1,50 @@ +/* # Copyright 2016-2018 Ivan Yelizariev + # Copyright 2017-2018 Artyom Losev + # Copyright 2018 Kolushov Alexandr + # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). */ odoo.define('mail_all.all', function (require) { "use strict"; -var chat_manager = require('mail_base.base').chat_manager; var core = require('web.core'); - -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; - } +var Manager = require('mail.Manager'); +var Mailbox = require('mail.model.Mailbox'); + +var _t = core._t; + +Manager.include({ + _updateMailboxesFromServer: function (data) { + var self = this; + this._super(data); + if (!_.find(this.getThreads(), function(th){ + return th.getID() === 'mailbox_channel_all'; + })) { + this._addMailbox({ + id: 'channel_all', + name: _t("All Messages"), + mailboxCounter: data.needaction_inbox_counter || 0, + }); + } + }, + + _makeMessage: function (data) { + var message = this._super(data); + message._addThread('mailbox_channel_all'); + return message; + }, }); -// override methods -var chat_manager_super = _.clone(chat_manager); - -chat_manager.get_properties = function (msg) { - var properties = chat_manager_super.get_properties.apply(this, arguments); - properties.is_all = this.property_descr("channel_all", msg, this); - return properties; -}; - -chat_manager.set_channel_flags = function (data, msg) { - chat_manager_super.set_channel_flags.apply(this, arguments); - msg.is_all = data.author_id !== 'ODOOBOT'; - return msg; -}; - -chat_manager.get_channel_array = function (msg) { - var arr = chat_manager_super.get_channel_array.apply(this, arguments); - return arr.concat('channel_all'); -}; - -chat_manager.get_domain = function (channel) { - return (channel.id === "channel_all") - ? [] - : chat_manager_super.get_domain.apply(this, arguments); -}; - - -chat_manager.is_ready.then(function () { - // Add all channel - chat_manager.add_channel({ - id: "channel_all", - name: _lt("All messages"), - type: "static" - }); - return $.when(); - }); +Mailbox.include({ + _getThreadDomain: function () { + if (this._id === 'mailbox_channel_all') { + return []; + } + return this._super(); + }, +}); -return chat_manager; +return { + 'Manager': Manager, + 'Mailbox': Mailbox, + }; }); diff --git a/mail_all/static/src/xml/menu.xml b/mail_all/static/src/xml/menu.xml index 1ed9bdc..5c592c3 100644 --- a/mail_all/static/src/xml/menu.xml +++ b/mail_all/static/src/xml/menu.xml @@ -1,17 +1,22 @@ +