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_archives/models/__init__.py b/mail_all/models/__init__.py similarity index 100% rename from mail_archives/models/__init__.py rename to mail_all/models/__init__.py 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/mail_archives/README.rst b/mail_archives/README.rst index 56bd506..0395c12 100644 --- a/mail_archives/README.rst +++ b/mail_archives/README.rst @@ -1,11 +1,11 @@ Mail Archives ============= -Adds Archive menu, which shows all messages +Adds Archive menu, which shows sent/received messages Usage ----- -Click Discuss/Archive menu -- all messages are displayed +Click Discuss/Archive menu -- sent/received messages are displayed Further information ------------------- diff --git a/mail_archives/__init__.py b/mail_archives/__init__.py index 5305644..40a96af 100644 --- a/mail_archives/__init__.py +++ b/mail_archives/__init__.py @@ -1,3 +1 @@ # -*- coding: utf-8 -*- - -from . import models \ No newline at end of file diff --git a/mail_archives/__openerp__.py b/mail_archives/__openerp__.py index 57c4508..737e949 100644 --- a/mail_archives/__openerp__.py +++ b/mail_archives/__openerp__.py @@ -13,9 +13,7 @@ 'currency': 'EUR', "depends": [ - "base", - "mail", - "mail_base" + "mail_sent", ], "data": [ diff --git a/mail_archives/static/src/js/archives.js b/mail_archives/static/src/js/archives.js index 912523a..436e55e 100644 --- a/mail_archives/static/src/js/archives.js +++ b/mail_archives/static/src/js/archives.js @@ -16,6 +16,15 @@ 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_archive"; + return options; + } +}); + // Inherit class and override methods base_obj.MailTools.include({ get_properties: function(msg){ @@ -26,7 +35,20 @@ base_obj.MailTools.include({ set_channel_flags: function(data, msg){ this._super.apply(this, arguments); - msg.is_archive = true; + // 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.sent && data.author_id[0] == session.partner_id) + || (recipients_ids.indexOf(session.partner_id) != -1) + ) { + msg.is_archive = true; + } + return msg; }, @@ -36,7 +58,11 @@ base_obj.MailTools.include({ }, get_domain: function(channel){ - return (channel.id === "channel_archive") ? [] : this._super.apply(this, arguments); + return (channel.id === "channel_archive") ? [ + '|', ['partner_ids', 'in', [openerp.session.partner_id]], + '&', ['sent', '=', true], + ['author_id.user_ids', 'in', [openerp.session.uid]] + ] : this._super.apply(this, arguments); } }); diff --git a/mail_base/static/src/js/base.js b/mail_base/static/src/js/base.js index 7e7549f..12f1111 100644 --- a/mail_base/static/src/js/base.js +++ b/mail_base/static/src/js/base.js @@ -63,6 +63,10 @@ var channel_seen = _.throttle(function (channel) { var ChatAction = core.action_registry.get('mail.chat.instant_messaging'); ChatAction.include({ + init: function(parent, action, options) { + this._super.apply(this, arguments); + this.show_send_message_button = ['channel_inbox']; + }, start: function() { var result = this._super.apply(this, arguments); @@ -93,6 +97,15 @@ ChatAction.include({ } }); return result; + }, + set_channel: function(channel){ + var result = this._super.apply(this, arguments); + var self = this; + return $.when(result).done(function() { + self.$buttons + .find('.o_mail_chat_button_new_message') + .toggle(self.show_send_message_button.indexOf(channel.id) != -1); + }); } }); diff --git a/mail_sent/static/src/js/sent.js b/mail_sent/static/src/js/sent.js index df2bc11..b5490ea 100644 --- a/mail_sent/static/src/js/sent.js +++ b/mail_sent/static/src/js/sent.js @@ -16,6 +16,20 @@ var web_client = require('web.web_client'); 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); + // Add channel Sent for show "Send message" button + this.show_send_message_button.push('channel_sent'); + }, + get_thread_rendering_options: function (messages) { + var options = this._super.apply(this, arguments); + options.display_subject = options.display_subject || this.channel.id === "channel_sent"; + return options; + } +}); + // Inherit class and override methods base_obj.MailTools.include({ get_properties: function(msg){ diff --git a/mail_to/doc/index.rst b/mail_to/doc/index.rst index de14c87..31597f2 100644 --- a/mail_to/doc/index.rst +++ b/mail_to/doc/index.rst @@ -9,4 +9,4 @@ Usage * Many messages have Recipients info. * Click Inbox left menu item, click Send mail button, set recipient and send message. This message will show recipient. * To see the recipient's need hover the mouse over a message. -* For messages created before install module it will not work where the recipients is not set there is not way restore recipients value. +* For messages created before install module it will not work where the recipients are not set. There is no way to restore recipients value. 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/static/src/js/res_partner_mails_count_tour.js b/res_partner_mails_count/static/src/js/res_partner_mails_count_tour.js index 1a12578..63ae3b1 100644 --- a/res_partner_mails_count/static/src/js/res_partner_mails_count_tour.js +++ b/res_partner_mails_count/static/src/js/res_partner_mails_count_tour.js @@ -22,17 +22,13 @@ odoo.define('res_partner_mails_count.res_partner_mails_count_tour', function (re waitFor: '.mails_to:visible', }, { - title: _t("Messages are found!"), + title: _t("Done"), placement: 'top', - waitNot: '.mails_to:visible', - element: '.o_mail_thread', - }, - { - wait: '5000', - waitFor: '.o_channel_name.mail_archives:visible', - title: _t("That's it"), - content: _t("Enjoy your day!

IT-Projects LLC team "), - popover: { next: _t("Close Tutorial") }, + waitNot: '.mails_to:visible', + waitFor: '.o_mail_thread', + element: '.o_mail_thread', + content: _t("Message are found.
Enjoy your day!

IT-Projects LLC team "), + popover: {next: _t("Close Tutorial")}, }, ] }); diff --git a/res_partner_mails_count/templates.xml b/res_partner_mails_count/templates.xml index dad17ec..3b48bcf 100644 --- a/res_partner_mails_count/templates.xml +++ b/res_partner_mails_count/templates.xml @@ -40,7 +40,8 @@ open - 200 + 500 + automatic 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' }