Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

11.0 mail addons merge #235

Merged
merged 17 commits into from
Oct 25, 2019
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion mail_base/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/odoo/odoo/blob/9.0/addons/mail/static/src/js/chat_manager.js#L57>`__
One can say, that the module do this todo from `addons/mail/static/src/js/chat_manager.js <https://github.com/odoo/odoo/blob/10.0/addons/mail/static/src/js/chat_manager.js#L57>`__

// to do: move this to mail.utils

Expand Down
1 change: 1 addition & 0 deletions mail_base/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html)

from . import models
from . import controllers
6 changes: 5 additions & 1 deletion mail_base/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# Copyright 2016 x620 <https://github.com/x620>
# Copyright 2018 Ruslan Ronzhin <https://it-projects.info/team/rusllan/>
# Copyright 2016-2019 Ivan Yelizariev <https://it-projects.info/team/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": "[email protected]",
Expand Down
3 changes: 3 additions & 0 deletions mail_base/controllers/main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright 2017 mikaelh <https://github.com/mikaelh>
# Copyright 2017-2019 Ivan Yelizariev <https://it-projects.info/team/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

Expand Down
4 changes: 4 additions & 0 deletions mail_base/doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
`1.1.0`
-------
- **New**: added ability to select channels for private message sending.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 checked


Ommo73 marked this conversation as resolved.
Show resolved Hide resolved
`1.0.5`
-------
**FIX**: polling errors on heavy server load
Expand Down
7 changes: 5 additions & 2 deletions mail_base/models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Copyright 2016 x620 <https://github.com/x620>
# Copyright 2017 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html)

from openerp import api, models

Expand All @@ -12,8 +15,8 @@ def write(self, values):
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)


Expand Down
3 changes: 3 additions & 0 deletions mail_base/static/lib/base.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/* Copyright 2017 Artyom Losev <https://github.com/ArtyomLosev>
Copyright 2019 Artem Rafailov <https://github.com/Ommo73>
License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html). */
odoo.define('mail_base.base', function (require) {
"use strict";

Expand Down
1 change: 1 addition & 0 deletions mail_private/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html)

from . import models
8 changes: 8 additions & 0 deletions mail_private/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Copyright 2016 x620 <https://github.com/x620>
# Copyright 2016 Ilmir Karamov <https://it-projects.info/team/ilmir-k>
# Copyright 2016 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# Copyright 2017 Artyom Losev <https://github.com/ArtyomLosev>
# Copyright 2018 Ruslan Ronzhin <https://it-projects.info/team/rusllan/>
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# Copyright 2019 Artem Rafailov <https://it-projects.info/team/Ommo73/>
# 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.""",
Expand Down
4 changes: 4 additions & 0 deletions mail_private/full_composer_wizard.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!--Copyright 2017 Artyom Losev <https://github.com/ArtyomLosev>
Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).-->

<odoo>

<record model="ir.ui.view" id="email_compose_message_wizard_form_private">
Expand Down
15 changes: 10 additions & 5 deletions mail_private/i18n/mail_private.pot
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 ""
Expand All @@ -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 ""
Expand All @@ -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 ""
Expand Down
6 changes: 6 additions & 0 deletions mail_private/models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Copyright 2016 x620 <https://github.com/x620>
# Copyright 2016 manawi <https://github.com/manawi>
# Copyright 2017 Artyom Losev <https://github.com/ArtyomLosev>
# Copyright 2019 Artem Rafailov <https://it-projects.info/team/Ommo73/>
# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).

from odoo import models, fields, api


Expand Down
78 changes: 72 additions & 6 deletions mail_private/static/src/js/mail_private.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* Copyright 2016-2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
Copyright 2016 manavi <https://github.com/manawi>
Copyright 2017-2018 Artyom Losev <https://github.com/ArtyomLosev>
Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). */
/* Copyright 2016 x620 <https://github.com/x620>
Copyright 2016 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
Copyright 2016 manawi <https://github.com/manawi>
Copyright 2017 Artyom Losev <https://github.com/ArtyomLosev>
Copyright 2019 Artem Rafailov <https://it-projects.info/team/Ommo73/>
License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html). */
odoo.define('mail_private', function (require) {
'use strict';

Expand Down Expand Up @@ -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(
Ommo73 marked this conversation as resolved.
Show resolved Hide resolved
Ommo73 marked this conversation as resolved.
Show resolved Hide resolved
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'Model' is not defined no-undef

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is suspicious, obsolete function for v11

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KolushovAlexandr Yep! You're right. I fixed it

['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(
Ommo73 marked this conversation as resolved.
Show resolved Hide resolved
Ommo73 marked this conversation as resolved.
Show resolved Hide resolved
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'Model' is not defined no-undef

'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(
Ommo73 marked this conversation as resolved.
Show resolved Hide resolved
Ommo73 marked this conversation as resolved.
Show resolved Hide resolved
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'Model' is not defined no-undef

'read', [res_channels_filtered, ['name', 'id']]
).then(function (recipients) {
return recipients;
});
});
});
},

get_internal_users_ids: function () {
var ResUser = new Model('mail.compose.message');
Ommo73 marked this conversation as resolved.
Show resolved Hide resolved
Ommo73 marked this conversation as resolved.
Show resolved Hide resolved
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'Model' is not defined no-undef

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({
Expand Down Expand Up @@ -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 () {
Ommo73 marked this conversation as resolved.
Show resolved Hide resolved
Ommo73 marked this conversation as resolved.
Show resolved Hide resolved
var self = this;
if (self.options.is_private) {
self.context.is_private = true;
}
return this._super();
},

on_open_full_composer: function() {
Expand Down
16 changes: 16 additions & 0 deletions mail_private/static/src/xml/mail_private.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--Copyright 2016 x620 <https://github.com/x620>
Copyright 2016 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
Copyright 2016 manawi <https://github.com/manawi>
Copyright 2017 Artyom Losev <https://github.com/ArtyomLosev>
Copyright 2019 Artem Rafailov <https://it-projects.info/team/Ommo73/>
License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).-->
<template>

<t t-extend="mail.Chatter.Buttons">
Expand All @@ -20,6 +26,16 @@
</small>
</t>
<t t-jquery="div[class='o_composer_suggested_partners']" t-operation="after">
<div class="o_composer_suggested_channels">
<t t-foreach='widget.suggested_channels' t-as='channel'>
<div t-attf-title="Add as channel and follower">
<input type="checkbox"
t-att-checked="channel.checked ? 'checked' : undefined"
t-att-data-fullname="channel.full_name"/>
<t t-esc="channel.name"/>
</div>
</t>
</div>
<button class="btn btn-sm btn-link oe_composer_uncheck" t-if="widget.options.is_private">Uncheck all</button>
</t>
</t>
Expand Down
2 changes: 2 additions & 0 deletions mail_private/template.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!--Copyright 2016 x620 <https://github.com/x620>
License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).-->
<odoo>
<template
id="assets_backend"
Expand Down
2 changes: 2 additions & 0 deletions mail_to/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).
from . import models
7 changes: 6 additions & 1 deletion mail_to/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# Copyright 2016 x620 <https://github.com/x620>
# Copyright 2016 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
# Copyright 2018 Ruslan Ronzhin
# Copyright 2019 Artem Rafailov <https://it-projects.info/team/Ommo73/>
# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).
{
"name": """Show message recipients""",
"summary": """Allows you be sure, that all discussion participants were notified""",
"category": "Discuss",
"images": ['images/1.png'],
"version": "11.0.1.0.1",
"version": "11.0.1.1.0",

"author": "IT-Projects LLC, Pavel Romanchenko",
"support": "[email protected]",
Expand Down
8 changes: 7 additions & 1 deletion mail_to/doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
`1.1.0`
-------

- **New**: channels are displayed in recipients

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 checked



Ommo73 marked this conversation as resolved.
Show resolved Hide resolved
`1.0.1`
-------

- **FIX:** The problem with duplicating the names of recipients was solved.
- **FIX**: the problem with duplicating the names of recipients was solved.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The -> the. Предлагаю обратно


`1.0.0`
-------
Expand Down
19 changes: 16 additions & 3 deletions mail_to/i18n/mail_to.pot
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,36 @@ msgstr ""
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: mail_to
#: model:ir.model,name:mail_to.model_mail_message
msgid "Message"
msgstr ""

#. module: mail_to
#. openerp-web
#: code:addons/mail_to/static/src/js/test_mail_to.js:13
#, python-format
msgid "Open Partners Form From Recipient Link"
msgstr ""

#. module: mail_to
#. openerp-web
#: code:addons/mail_to/static/src/xml/recipient.xml:6
#: code:addons/mail_to/static/src/xml/recipient.xml:10
#: code:addons/mail_to/static/src/xml/recipient.xml:11
#, python-format
msgid "To:"
msgstr ""

#. module: mail_to
#. openerp-web
#: code:addons/mail_to/static/src/xml/recipient.xml:15
#: code:addons/mail_to/static/src/xml/recipient.xml:32
#, python-format
msgid "and"
msgstr ""

#. module: mail_to
#. openerp-web
#: code:addons/mail_to/static/src/xml/recipient.xml:16
#: code:addons/mail_to/static/src/xml/recipient.xml:33
#, python-format
msgid "more"
msgstr ""
Expand Down
2 changes: 2 additions & 0 deletions mail_to/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import mail_message
18 changes: 18 additions & 0 deletions mail_to/models/mail_message.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
# Copyright 2019 Artem Rafailov <https://it-projects.info/team/Ommo73/>
# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).
from odoo import models, api


class MailMessage(models.Model):
_inherit = 'mail.message'

@api.multi
def message_format(self):
messages_values = super(MailMessage, self).message_format()
for i in messages_values:
if i['channel_ids']:
i['channel_names'] = self.env['mail.channel'].browse(i['channel_ids']).mapped(
lambda r: [r.id, '#' + r.display_name])

return messages_values
Loading