diff --git a/.travis.yml b/.travis.yml index 67b0503..74b5194 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,8 @@ env: matrix: - LINT_CHECK="1" - CHECK_TAGS="1" - - TESTS="1" ODOO_REPO="odoo/odoo" MAKEPOT="1" + - TESTS="1" ODOO_REPO="odoo/odoo" + - MAKEPOT="1" - TESTS="1" ODOO_REPO="OCA/OCB" install: diff --git a/mail_base/README.rst b/mail_base/README.rst index d93f8c6..aba0463 100644 --- a/mail_base/README.rst +++ b/mail_base/README.rst @@ -7,7 +7,7 @@ * fixes toggling left bar * fixes Recipients field. Out-of-box this field could be empty. -One can say, that the module do this todo from `addons/mail/static/src/js/chat_manager.js `__ +One can say, that the module do this todo from `addons/mail/static/src/js/chat_manager.js `__ // to do: move this to mail.utils diff --git a/mail_base/__init__.py b/mail_base/__init__.py index 7cdad7f..dd5379d 100644 --- a/mail_base/__init__.py +++ b/mail_base/__init__.py @@ -1,3 +1,4 @@ +# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html) from . import models from . import controllers diff --git a/mail_base/__manifest__.py b/mail_base/__manifest__.py index 87e8f3f..12d535e 100644 --- a/mail_base/__manifest__.py +++ b/mail_base/__manifest__.py @@ -1,9 +1,13 @@ +# Copyright 2016 x620 +# Copyright 2018 Ruslan Ronzhin +# Copyright 2016-2019 Ivan Yelizariev +# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html) { "name": "Mail Base", "summary": """Makes Mail extendable""", "category": "Discuss", "images": [], - "version": "11.0.1.0.5", + "version": "11.0.1.1.0", "author": "IT-Projects LLC, Pavel Romanchenko", "support": "apps@it-projects.info", diff --git a/mail_base/controllers/main.py b/mail_base/controllers/main.py index fa772e8..d739b56 100644 --- a/mail_base/controllers/main.py +++ b/mail_base/controllers/main.py @@ -1,3 +1,6 @@ +# Copyright 2017 mikaelh +# Copyright 2017-2019 Ivan Yelizariev +# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html) from openerp.http import request from openerp.addons.bus.controllers.main import BusController diff --git a/mail_base/doc/changelog.rst b/mail_base/doc/changelog.rst index d1474d8..8825558 100644 --- a/mail_base/doc/changelog.rst +++ b/mail_base/doc/changelog.rst @@ -1,3 +1,7 @@ +`1.1.0` +------- +- **New**: added ability to select channels for private message sending. + `1.0.5` ------- **FIX**: polling errors on heavy server load diff --git a/mail_base/models.py b/mail_base/models.py index 9bdf491..5f0a329 100644 --- a/mail_base/models.py +++ b/mail_base/models.py @@ -1,3 +1,6 @@ +# Copyright 2016 x620 +# Copyright 2017 Ivan Yelizariev +# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html) from openerp import api, models @@ -12,8 +15,8 @@ class MailMessage(models.Model): values['partner_ids'] = [] for triplet in values.get('needaction_partner_ids'): if triplet[0] == 6: - for id in triplet[2]: - values['partner_ids'].append((4, id, False)) + for i in triplet[2]: + values['partner_ids'].append((4, i, False)) return super(MailMessage, self).write(values) diff --git a/mail_base/static/lib/base.js b/mail_base/static/lib/base.js index 42433e7..a00f7bc 100644 --- a/mail_base/static/lib/base.js +++ b/mail_base/static/lib/base.js @@ -1,3 +1,6 @@ +/* Copyright 2017 Artyom Losev + Copyright 2019 Artem Rafailov + License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html). */ odoo.define('mail_base.base', function (require) { "use strict"; diff --git a/mail_private/__init__.py b/mail_private/__init__.py index a9e3372..ac86c5f 100644 --- a/mail_private/__init__.py +++ b/mail_private/__init__.py @@ -1,2 +1,3 @@ +# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html) from . import models diff --git a/mail_private/__manifest__.py b/mail_private/__manifest__.py index 0a32ca1..cbeac30 100644 --- a/mail_private/__manifest__.py +++ b/mail_private/__manifest__.py @@ -1,3 +1,11 @@ +# Copyright 2016 x620 +# Copyright 2016 Ilmir Karamov +# Copyright 2016 Ivan Yelizariev +# Copyright 2017 Artyom Losev +# Copyright 2018 Ruslan Ronzhin +# Copyright 2018 Kolushov Alexandr +# Copyright 2019 Artem Rafailov +# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html). { "name": """Internal Messaging""", "summary": """Send private messages to specified recipients, regardless of who are in followers list.""", diff --git a/mail_private/full_composer_wizard.xml b/mail_private/full_composer_wizard.xml index 9f57a20..46daeb5 100644 --- a/mail_private/full_composer_wizard.xml +++ b/mail_private/full_composer_wizard.xml @@ -1,4 +1,8 @@ + + diff --git a/mail_private/i18n/mail_private.pot b/mail_private/i18n/mail_private.pot index 90f25bb..312ec8b 100644 --- a/mail_private/i18n/mail_private.pot +++ b/mail_private/i18n/mail_private.pot @@ -34,6 +34,11 @@ msgstr "" msgid "Dummy action" msgstr "" +#. module: mail_private +#: model:ir.model,name:mail_private.model_mail_thread +msgid "Email Thread" +msgstr "" + #. module: mail_private #: model:ir.model,name:mail_private.model_mail_compose_message msgid "Email composition wizard" @@ -60,7 +65,7 @@ msgstr "" #. module: mail_private #. openerp-web -#: code:addons/mail_private/static/src/xml/mail_private.xml:6 +#: code:addons/mail_private/static/src/xml/mail_private.xml:12 #, python-format msgid "Send a message to specified recipients only" msgstr "" @@ -75,21 +80,21 @@ msgstr "" #. module: mail_private #. openerp-web -#: code:addons/mail_private/static/src/xml/mail_private.xml:6 +#: code:addons/mail_private/static/src/xml/mail_private.xml:12 #, python-format msgid "Send internal message" msgstr "" #. module: mail_private #. openerp-web -#: code:addons/mail_private/static/src/xml/mail_private.xml:12 +#: code:addons/mail_private/static/src/xml/mail_private.xml:18 #, python-format msgid "To: Followers of" msgstr "" #. module: mail_private #. openerp-web -#: code:addons/mail_private/static/src/xml/mail_private.xml:23 +#: code:addons/mail_private/static/src/xml/mail_private.xml:39 #, python-format msgid "Uncheck all" msgstr "" @@ -110,7 +115,7 @@ msgstr "" #. module: mail_private #. openerp-web -#: code:addons/mail_private/static/src/xml/mail_private.xml:17 +#: code:addons/mail_private/static/src/xml/mail_private.xml:23 #, python-format msgid "this document" msgstr "" diff --git a/mail_private/models.py b/mail_private/models.py index ae63b3f..0872f01 100644 --- a/mail_private/models.py +++ b/mail_private/models.py @@ -1,3 +1,9 @@ +# Copyright 2016 x620 +# Copyright 2016 manawi +# Copyright 2017 Artyom Losev +# Copyright 2019 Artem Rafailov +# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html). + from odoo import models, fields, api diff --git a/mail_private/static/src/js/mail_private.js b/mail_private/static/src/js/mail_private.js index 4b3a7d0..78ef21e 100644 --- a/mail_private/static/src/js/mail_private.js +++ b/mail_private/static/src/js/mail_private.js @@ -1,8 +1,9 @@ -/* Copyright 2016-2018 Ivan Yelizariev - Copyright 2016 manavi - Copyright 2017-2018 Artyom Losev - Copyright 2018 Kolushov Alexandr - License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). */ +/* Copyright 2016 x620 + Copyright 2016 Ivan Yelizariev + Copyright 2016 manawi + Copyright 2017 Artyom Losev + Copyright 2019 Artem Rafailov + License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html). */ odoo.define('mail_private', function (require) { 'use strict'; @@ -98,7 +99,61 @@ Chatter.include({ return obj.partner_id !== session.partner_id; }); }); - } + }, + + get_channels_for_internal_message: function () { + var self = this; + self.result = {}; + return new Model(this.context.default_model).query( + ['message_follower_ids', 'partner_id']).filter( + [['id', '=', self.context.default_res_id]]).all() + .then(function (thread) { + var follower_ids = thread[0].message_follower_ids; + self.result[self.context.default_res_id] = []; + self.customer = thread[0].partner_id; + + // Fetch channels ids + return new Model('mail.followers').call( + 'read', [follower_ids, ['channel_id']]).then(function (res_channels) { + // Filter result and push to array + var res_channels_filtered = _.map(res_channels, function (channel) { + if (channel.channel_id[0]) { + return channel.channel_id[0]; + } + }).filter(function (channel) { + return typeof channel !== 'undefined'; + }); + + return new Model('mail.channel').call( + 'read', [res_channels_filtered, ['name', 'id']] + ).then(function (recipients) { + return recipients; + }); + }); + }); + }, + + get_internal_users_ids: function () { + var ResUser = new Model('mail.compose.message'); + this.users_ids = ResUser.call('get_internal_users_ids', [[]]).then( function (users_ids) { + return users_ids; + }); + return this.users_ids; + }, + + get_checked_channels_ids: function () { + var self = this; + var checked_channels = []; + this.$('.o_composer_suggested_channels input:checked').each(function() { + var full_name = $(this).data('fullname').toString(); + _.each(self.channels_for_internal_message, function(item) { + if (full_name === item.name) { + checked_channels.push(item.id); + } + }); + }); + return checked_channels; + }, }); ChatterComposer.include({ @@ -154,6 +209,17 @@ ChatterComposer.include({ this.$('.o_composer_suggested_partners input:checked').each(function() { $(this).prop('checked', false); }); + this.$('.o_composer_suggested_channels input:checked').each(function() { + $(this).prop('checked', false); + }); + }, + + preprocess_message: function () { + var self = this; + if (self.options.is_private) { + self.context.is_private = true; + } + return this._super(); }, on_open_full_composer: function() { diff --git a/mail_private/static/src/xml/mail_private.xml b/mail_private/static/src/xml/mail_private.xml index baadbb5..42282e4 100644 --- a/mail_private/static/src/xml/mail_private.xml +++ b/mail_private/static/src/xml/mail_private.xml @@ -1,4 +1,10 @@ +