diff --git a/mail_archives/README.rst b/mail_archives/README.rst index 965deec..de8ef85 100644 --- a/mail_archives/README.rst +++ b/mail_archives/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_archives/ +HTML Description: https://apps.odoo.com/apps/modules/12.0/mail_archives/ Usage instructions: ``_ Changelog: ``_ -Tested on Odoo 11.0 ecbf7aa4714479229658d14cce28fa00376ed390 +Tested on Odoo 12.0 c423e5fe047a66517a60b68874e18dc5c3697787 diff --git a/mail_archives/__manifest__.py b/mail_archives/__manifest__.py index d1205cf..91c4f81 100644 --- a/mail_archives/__manifest__.py +++ b/mail_archives/__manifest__.py @@ -3,7 +3,7 @@ "summary": """Adds menu to find old messages""", "category": "Discuss", "images": ['images/1.jpg'], - "version": "11.0.1.0.0", + "version": "12.0.1.0.0", "author": "IT-Projects LLC, Pavel Romanchenko", "support": "apps@it-projects.info", @@ -13,7 +13,7 @@ 'currency': 'EUR', "depends": [ - "mail_base", + "mail", ], "data": [ @@ -22,5 +22,5 @@ "qweb": [ "static/src/xml/menu.xml", ], - 'installable': False, + 'installable': True, } diff --git a/mail_archives/static/description/index.html b/mail_archives/static/description/index.html index 0b01710..f30d524 100644 --- a/mail_archives/static/description/index.html +++ b/mail_archives/static/description/index.html @@ -59,7 +59,7 @@ This menu shows archive messages, i.e. ones you sent or received. -o-transform: rotate(6deg); -moz-transform: rotate(6deg); -ms-transform: rotate(6deg);"> - Tested on Odoo
11.0 community + Tested on Odoo
12.0 community
- Tested on Odoo
11.0 enterprise + Tested on Odoo
12.0 enterprise
diff --git a/mail_archives/static/src/js/archives.js b/mail_archives/static/src/js/archives.js index 7fb0969..279e8e8 100644 --- a/mail_archives/static/src/js/archives.js +++ b/mail_archives/static/src/js/archives.js @@ -3,74 +3,48 @@ odoo.define('mail_archives.archives', function (require) { var core = require('web.core'); var session = require('web.session'); -var chat_manager = require('mail_base.base').chat_manager; - -var _lt = core._lt; - - -var ChatAction = core.action_registry.get('mail.chat.instant_messaging'); -ChatAction.include({ - init: function (parent, action, options) { - this._super.apply(this, arguments); - var channel_name = 'channel_archive'; - // Add channel Archive for enable "display_subject" option - this.channels_display_subject.push(channel_name); +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_archive'; + })) { + this._addMailbox({ + id: 'channel_archive', + name: _t("Archive"), + mailboxCounter: data.needaction_inbox_counter || 0, + }); + } }, - update_message_on_current_channel: function (current_channel_id, message){ - var result = this._super.apply(this, arguments); - var archive = current_channel_id === "channel_archive" && !message.is_archive; - return archive || result; - } + _makeMessage: function (data) { + var message = this._super(data); + message._addThread('mailbox_channel_archive'); + return message; + }, }); -// Inherit class and 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_archive = this.property_descr("channel_archive", msg, this); - return properties; -}; - -chat_manager.set_channel_flags = function (data, msg) { - chat_manager_super.set_channel_flags.apply(this, arguments); - // Get recipients ids - var recipients_ids = []; - for (var i = 0; i < (data.partner_ids || []).length; i++){ - recipients_ids.push(data.partner_ids[i][0]); - } - - // If author or recipient - if (data.author_id[0] === session.partner_id || recipients_ids.indexOf(session.partner_id) !== -1) { - msg.is_archive = true; - } - - return msg; -}; - -chat_manager.get_channel_array = function (msg) { - var arr = chat_manager_super.get_channel_array.apply(this, arguments); - return arr.concat('channel_archive'); -}; - -chat_manager.get_domain = function (channel) { - return (channel.id === "channel_archive") - ? ['|', ['partner_ids', 'in', [session.partner_id]], - ['author_id', 'in', [session.partner_id]]] - : chat_manager_super.get_domain.apply(this, arguments); -}; - -chat_manager.is_ready.then(function () { - chat_manager.add_channel({ - id: "channel_archive", - name: _lt("Archive"), - type: "static" - }); +Mailbox.include({ + _getThreadDomain: function () { + if (this._id === 'mailbox_channel_archive') { + return ['|', + ['partner_ids', 'in', [session.partner_id]], + ['author_id', 'in', [session.partner_id]] + ]; + } + return this._super(); + }, }); - -return chat_manager; +return { + 'Manager': Manager, + 'Mailbox': Mailbox, +}; }); diff --git a/mail_archives/static/src/xml/menu.xml b/mail_archives/static/src/xml/menu.xml index f446be3..cdef0f9 100644 --- a/mail_archives/static/src/xml/menu.xml +++ b/mail_archives/static/src/xml/menu.xml @@ -1,17 +1,20 @@