diff --git a/mail_sent/README.rst b/mail_sent/README.rst index c461f15..1530cf8 100644 --- a/mail_sent/README.rst +++ b/mail_sent/README.rst @@ -20,7 +20,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! @@ -29,12 +29,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_sent/ +HTML Description: https://apps.odoo.com/apps/modules/12.0/mail_sent/ Usage instructions: ``_ Changelog: ``_ -Tested on Odoo 11.0 ecbf7aa4714479229658d14cce28fa00376ed390 +Tested on Odoo 12.0 c423e5fe047a66517a60b68874e18dc5c3697787 diff --git a/mail_sent/__manifest__.py b/mail_sent/__manifest__.py index ca9c784..43ccc94 100644 --- a/mail_sent/__manifest__.py +++ b/mail_sent/__manifest__.py @@ -3,7 +3,7 @@ "summary": """Quick way to find sent messages""", "category": "Discuss", "images": ['images/menu.png'], - "version": "11.0.1.0.4", + "version": "12.0.1.0.4", "author": "IT-Projects LLC, Ivan Yelizariev, Pavel Romanchenko", "support": "apps@it-projects.info", @@ -13,9 +13,7 @@ 'currency': 'EUR', "depends": [ - "base", "mail", - "mail_base" ], "data": [ @@ -24,5 +22,5 @@ "qweb": [ "static/src/xml/menu.xml", ], - 'installable': False, + 'installable': True, } diff --git a/mail_sent/static/description/index.html b/mail_sent/static/description/index.html index 7586097..fe69aab 100644 --- a/mail_sent/static/description/index.html +++ b/mail_sent/static/description/index.html @@ -61,7 +61,7 @@ This menu shows messages in threads (like in other menus), but shows only sent m -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_sent/static/src/js/sent.js b/mail_sent/static/src/js/sent.js index 7b37ea7..670f909 100644 --- a/mail_sent/static/src/js/sent.js +++ b/mail_sent/static/src/js/sent.js @@ -3,67 +3,48 @@ odoo.define('mail_sent.sent', 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_sent'; - // Add channel Sent for show "Send message" button - this.channels_show_send_button.push(channel_name); - // Add channel Sent 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_sent'; + })) { + this._addMailbox({ + id: 'channel_sent', + name: _t("Sent Messages"), + mailboxCounter: data.needaction_inbox_counter || 0, + }); + } }, - update_message_on_current_channel: function (current_channel_id, message) { - var result = this._super.apply(this, arguments); - var sent = current_channel_id === "channel_sent" && !message.is_sent; - return sent || result; - } + _makeMessage: function (data) { + var message = this._super(data); + message._addThread('mailbox_channel_sent'); + 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_sent = this.property_descr("channel_sent", msg, this); - return properties; -}; - -chat_manager.set_channel_flags = function (data, msg) { - chat_manager_super.set_channel_flags.apply(this, arguments); - if (data.sent && data.author_id[0] === session.partner_id) { - msg.is_sent = 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_sent'); -}; - -chat_manager.get_domain = function (channel) { - return (channel.id === "channel_sent") - ? [['sent', '=', true],['author_id.user_ids', 'in', [session.uid]]] - : chat_manager_super.get_domain.apply(this, arguments); -}; - - -chat_manager.is_ready.then(function () { - // Add sent channel - chat_manager.add_channel({ - id: "channel_sent", - name: _lt("Sent"), - type: "static" - }); - return $.when(); +Mailbox.include({ + _getThreadDomain: function () { + if (this._id === 'mailbox_channel_sent') { + return [ + ['sent', '=', true], + ['author_id.user_ids', 'in', [session.uid]] + ]; + } + return this._super(); + }, }); -return chat_manager; +return { + 'Manager': Manager, + 'Mailbox': Mailbox, +}; }); diff --git a/mail_sent/static/src/xml/menu.xml b/mail_sent/static/src/xml/menu.xml index 48bf267..ab90c7b 100644 --- a/mail_sent/static/src/xml/menu.xml +++ b/mail_sent/static/src/xml/menu.xml @@ -1,17 +1,18 @@