odoo-addon-mail-gateway 16.0.1.3.0__py3-none-any.whl → 18.0.1.0.0.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of odoo-addon-mail-gateway might be problematic. Click here for more details.
- odoo/addons/mail_gateway/README.rst +41 -24
- odoo/addons/mail_gateway/__init__.py +1 -1
- odoo/addons/mail_gateway/__manifest__.py +7 -14
- odoo/addons/mail_gateway/controllers/__init__.py +0 -1
- odoo/addons/mail_gateway/controllers/gateway.py +5 -2
- odoo/addons/mail_gateway/hooks.py +3 -3
- odoo/addons/mail_gateway/i18n/es.po +68 -406
- odoo/addons/mail_gateway/i18n/it.po +5 -336
- odoo/addons/mail_gateway/i18n/mail_gateway.pot +140 -121
- odoo/addons/mail_gateway/models/__init__.py +4 -3
- odoo/addons/mail_gateway/models/{mail_channel.py → discuss_channel.py} +45 -17
- odoo/addons/mail_gateway/models/ir_websocket.py +1 -1
- odoo/addons/mail_gateway/models/mail_gateway.py +8 -8
- odoo/addons/mail_gateway/models/mail_gateway_abstract.py +3 -3
- odoo/addons/mail_gateway/models/mail_guest.py +6 -4
- odoo/addons/mail_gateway/models/mail_message.py +40 -21
- odoo/addons/mail_gateway/models/mail_notification.py +15 -8
- odoo/addons/mail_gateway/models/mail_thread.py +56 -10
- odoo/addons/mail_gateway/models/res_partner.py +10 -32
- odoo/addons/mail_gateway/models/res_users.py +3 -4
- odoo/addons/mail_gateway/models/res_users_settings.py +12 -0
- odoo/addons/mail_gateway/readme/CONTRIBUTORS.md +5 -0
- odoo/addons/mail_gateway/readme/{CREDITS.rst → CREDITS.md} +2 -1
- odoo/addons/mail_gateway/readme/DESCRIPTION.md +8 -0
- odoo/addons/mail_gateway/readme/ROADMAP.md +1 -0
- odoo/addons/mail_gateway/readme/USAGE.md +12 -0
- odoo/addons/mail_gateway/security/ir.model.access.csv +4 -2
- odoo/addons/mail_gateway/security/security.xml +9 -10
- odoo/addons/mail_gateway/static/description/index.html +46 -28
- odoo/addons/mail_gateway/static/src/components/chatter/chatter.esm.js +14 -0
- odoo/addons/mail_gateway/static/src/components/chatter/chatter.xml +42 -22
- odoo/addons/mail_gateway/static/src/components/composer/composer.esm.js +107 -0
- odoo/addons/mail_gateway/static/src/components/gateway_follower/gateway_follower.esm.js +35 -23
- odoo/addons/mail_gateway/static/src/components/gateway_follower/gateway_follower.xml +3 -5
- odoo/addons/mail_gateway/static/src/components/message/message.xml +15 -15
- odoo/addons/mail_gateway/static/src/components/message/message_patch.esm.js +67 -0
- odoo/addons/mail_gateway/static/src/components/message_notification_popover_content/message_notification_popover_content.xml +3 -7
- odoo/addons/mail_gateway/static/src/core/common/composer_model_patch.esm.js +22 -0
- odoo/addons/mail_gateway/static/src/core/common/discuss_app_model_patch.esm.js +25 -0
- odoo/addons/mail_gateway/static/src/core/common/mail_composer_send_dropdown.esm.js +27 -0
- odoo/addons/mail_gateway/static/src/core/common/mail_composer_send_dropdown.xml +15 -0
- odoo/addons/mail_gateway/static/src/core/common/message_actions.esm.js +25 -0
- odoo/addons/mail_gateway/static/src/core/common/message_model_patch.esm.js +25 -0
- odoo/addons/mail_gateway/static/src/core/common/notification_model_patch.esm.js +34 -0
- odoo/addons/mail_gateway/static/src/core/common/persona_model_patch.esm.js +10 -0
- odoo/addons/mail_gateway/static/src/core/common/store_service_patch.esm.js +18 -0
- odoo/addons/mail_gateway/static/src/core/common/thread_model_patch.esm.js +54 -0
- odoo/addons/mail_gateway/static/src/core/web/discuss_app_category_model_patch.esm.js +19 -0
- odoo/addons/mail_gateway/static/src/core/web/discuss_sidebar_category_item_patch.xml +16 -0
- odoo/addons/mail_gateway/static/src/core/web/gateway_core_web_service.esm.js +36 -0
- odoo/addons/mail_gateway/static/src/models/gateway.esm.js +21 -15
- odoo/addons/mail_gateway/static/src/models/gateway_channel.esm.js +20 -13
- odoo/addons/mail_gateway/static/src/models/gateway_follower.esm.js +23 -0
- odoo/addons/mail_gateway/tools/__init__.py +1 -0
- odoo/addons/mail_gateway/tools/discuss.py +16 -0
- odoo/addons/mail_gateway/views/mail_gateway.xml +7 -7
- odoo/addons/mail_gateway/views/mail_guest_views.xml +15 -0
- odoo/addons/mail_gateway/views/res_partner_gateway_channel.xml +3 -4
- odoo/addons/mail_gateway/views/res_users_settings_views.xml +12 -0
- odoo/addons/mail_gateway/wizards/mail_compose_gateway_message.py +19 -4
- odoo/addons/mail_gateway/wizards/mail_compose_gateway_message.xml +2 -7
- odoo/addons/mail_gateway/wizards/mail_guest_manage.py +2 -3
- odoo/addons/mail_gateway/wizards/mail_guest_manage.xml +2 -6
- odoo/addons/mail_gateway/wizards/mail_message_gateway_link.py +3 -6
- odoo/addons/mail_gateway/wizards/mail_message_gateway_link.xml +0 -2
- odoo/addons/mail_gateway/wizards/mail_message_gateway_send.py +0 -1
- odoo/addons/mail_gateway/wizards/mail_message_gateway_send.xml +0 -4
- {odoo_addon_mail_gateway-16.0.1.3.0.dist-info → odoo_addon_mail_gateway-18.0.1.0.0.3.dist-info}/METADATA +48 -30
- odoo_addon_mail_gateway-18.0.1.0.0.3.dist-info/RECORD +77 -0
- {odoo_addon_mail_gateway-16.0.1.3.0.dist-info → odoo_addon_mail_gateway-18.0.1.0.0.3.dist-info}/WHEEL +1 -1
- odoo_addon_mail_gateway-18.0.1.0.0.3.dist-info/top_level.txt +1 -0
- odoo/addons/mail_gateway/controllers/discuss.py +0 -11
- odoo/addons/mail_gateway/i18n/es_VE.po +0 -879
- odoo/addons/mail_gateway/readme/CONTRIBUTORS.rst +0 -2
- odoo/addons/mail_gateway/readme/DESCRIPTION.rst +0 -5
- odoo/addons/mail_gateway/readme/USAGE.rst +0 -9
- odoo/addons/mail_gateway/static/src/components/composer/composer.xml +0 -24
- odoo/addons/mail_gateway/static/src/components/discuss_sidebar/discuss_sidebar.xml +0 -17
- odoo/addons/mail_gateway/static/src/models/channel.esm.js +0 -33
- odoo/addons/mail_gateway/static/src/models/channel_member_view.esm.js +0 -39
- odoo/addons/mail_gateway/static/src/models/chatter.esm.js +0 -41
- odoo/addons/mail_gateway/static/src/models/composer.esm.js +0 -32
- odoo/addons/mail_gateway/static/src/models/composer_gateway_follower.esm.js +0 -32
- odoo/addons/mail_gateway/static/src/models/composer_view.esm.js +0 -103
- odoo/addons/mail_gateway/static/src/models/discuss.esm.js +0 -51
- odoo/addons/mail_gateway/static/src/models/discuss_sidebar_category.esm.js +0 -128
- odoo/addons/mail_gateway/static/src/models/discuss_sidebar_category_item.esm.js +0 -51
- odoo/addons/mail_gateway/static/src/models/gateway_channel_view.esm.js +0 -15
- odoo/addons/mail_gateway/static/src/models/guest.esm.js +0 -10
- odoo/addons/mail_gateway/static/src/models/message.esm.js +0 -76
- odoo/addons/mail_gateway/static/src/models/message_action.esm.js +0 -45
- odoo/addons/mail_gateway/static/src/models/message_action_list.esm.js +0 -37
- odoo/addons/mail_gateway/static/src/models/message_action_view.esm.js +0 -91
- odoo/addons/mail_gateway/static/src/models/message_view.esm.js +0 -13
- odoo/addons/mail_gateway/static/src/models/messaging_initializer.esm.js +0 -24
- odoo/addons/mail_gateway/static/src/models/notification.esm.js +0 -20
- odoo/addons/mail_gateway/static/src/models/partner.esm.js +0 -11
- odoo/addons/mail_gateway/static/src/models/thread.esm.js +0 -77
- odoo_addon_mail_gateway-16.0.1.3.0.dist-info/RECORD +0 -78
- odoo_addon_mail_gateway-16.0.1.3.0.dist-info/top_level.txt +0 -1
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
This module will allow you to integrate an external chat system in your Odoo system.
|
|
2
|
-
It requires extra modules with the specific configuration of each chat system, like `mail_gateway_telegram` or `mail_gateway_whatsapp`.
|
|
3
|
-
|
|
4
|
-
This way, a group of users can respond customers or any other set
|
|
5
|
-
of partners within Odoo, but the messages will be sent through the external chat system.
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
When external messages are received, they will be directly sent to the discuss menu.
|
|
2
|
-
Answering to these messages will send the answer to the external contact.
|
|
3
|
-
We can assign this messages to any record using the message actions.
|
|
4
|
-
Also, we can assign the sender to a partner using the followers menu and selecting the partner.
|
|
5
|
-
|
|
6
|
-
On a standard record associated to a partner with external chat, we can send messages to the external contact directly selecting the methods of the partner.
|
|
7
|
-
To use this, we just need to use the
|
|
8
|
-
|
|
9
|
-
It is recomended to enable chatter notification to all users that will receive messages from gateways.
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" ?>
|
|
2
|
-
<templates xml:space="preserve">
|
|
3
|
-
|
|
4
|
-
<t
|
|
5
|
-
t-name="mail_gateway.Composer"
|
|
6
|
-
t-inherit="mail.Composer"
|
|
7
|
-
t-inherit-mode="extension"
|
|
8
|
-
owl="1"
|
|
9
|
-
>
|
|
10
|
-
<xpath expr="//small[hasclass('o_Composer_followers')]/.." position="after">
|
|
11
|
-
<t t-if="composerView.composer.isGateway">
|
|
12
|
-
<small><b class="text-muted">To: </b></small>
|
|
13
|
-
<t
|
|
14
|
-
t-foreach="composerView.composer.composerGatewayFollowers"
|
|
15
|
-
t-as="followerGateway"
|
|
16
|
-
t-key="followerGateway.follower"
|
|
17
|
-
>
|
|
18
|
-
<GatewayFollowerView record="followerGateway" />
|
|
19
|
-
</t>
|
|
20
|
-
</t>
|
|
21
|
-
</xpath>
|
|
22
|
-
|
|
23
|
-
</t>
|
|
24
|
-
</templates>
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" ?>
|
|
2
|
-
<templates xml:space="preserve">
|
|
3
|
-
<t t-inherit="mail.DiscussSidebar" t-inherit-mode="extension">
|
|
4
|
-
<xpath expr="//*[@name='beforeCategoryChat']" position="before">
|
|
5
|
-
<t
|
|
6
|
-
t-foreach="discussView.discuss.categoryGateways"
|
|
7
|
-
t-as="categoryGateway"
|
|
8
|
-
t-key="categoryGateway"
|
|
9
|
-
>
|
|
10
|
-
<DiscussSidebarCategory
|
|
11
|
-
className="'o_DiscussSidebar_category o_DiscussSidebar_categoryGateway' + categoryGateway.gateway_id"
|
|
12
|
-
record="categoryGateway"
|
|
13
|
-
/>
|
|
14
|
-
</t>
|
|
15
|
-
</xpath>
|
|
16
|
-
</t>
|
|
17
|
-
</templates>
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/** @odoo-module **/
|
|
2
|
-
|
|
3
|
-
import {clear} from "@mail/model/model_field_command";
|
|
4
|
-
import {registerPatch} from "@mail/model/model_core";
|
|
5
|
-
|
|
6
|
-
registerPatch({
|
|
7
|
-
name: "Channel",
|
|
8
|
-
fields: {
|
|
9
|
-
discussSidebarCategory: {
|
|
10
|
-
compute() {
|
|
11
|
-
// On gateway channels we must set the right category
|
|
12
|
-
if (this.thread && this.thread.gateway) {
|
|
13
|
-
const category = this.messaging.discuss.categoryGateways.filter(
|
|
14
|
-
(ctg) => ctg.gateway === this.thread.gateway
|
|
15
|
-
);
|
|
16
|
-
if (category.length > 0) {
|
|
17
|
-
return category[0];
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return this._super();
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
correspondent: {
|
|
24
|
-
compute() {
|
|
25
|
-
// We will not set a correspondent on gateways, as it gets yourself.
|
|
26
|
-
if (this.channel_type === "gateway") {
|
|
27
|
-
return clear();
|
|
28
|
-
}
|
|
29
|
-
return this._super();
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
});
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/** @odoo-module **/
|
|
2
|
-
|
|
3
|
-
import {registerPatch} from "@mail/model/model_core";
|
|
4
|
-
|
|
5
|
-
registerPatch({
|
|
6
|
-
name: "ChannelMemberView",
|
|
7
|
-
recordMethods: {
|
|
8
|
-
onClickMember(ev) {
|
|
9
|
-
if (
|
|
10
|
-
this.channelMember.persona.guest &&
|
|
11
|
-
this.channelMember.persona.guest.gateway
|
|
12
|
-
) {
|
|
13
|
-
ev.stopPropagation();
|
|
14
|
-
return this.env.services.action.doAction({
|
|
15
|
-
name: this.env._t("Manage guest"),
|
|
16
|
-
type: "ir.actions.act_window",
|
|
17
|
-
res_model: "mail.guest.manage",
|
|
18
|
-
context: {default_guest_id: this.channelMember.persona.guest.id},
|
|
19
|
-
views: [[false, "form"]],
|
|
20
|
-
target: "new",
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
return this._super();
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
fields: {
|
|
27
|
-
hasOpenChat: {
|
|
28
|
-
compute() {
|
|
29
|
-
return (
|
|
30
|
-
this._super() ||
|
|
31
|
-
Boolean(
|
|
32
|
-
this.channelMember.persona.guest &&
|
|
33
|
-
this.channelMember.persona.guest.gateway
|
|
34
|
-
)
|
|
35
|
-
);
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
});
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/** @odoo-module **/
|
|
2
|
-
|
|
3
|
-
import {clear} from "@mail/model/model_field_command";
|
|
4
|
-
import {registerPatch} from "@mail/model/model_core";
|
|
5
|
-
|
|
6
|
-
registerPatch({
|
|
7
|
-
name: "Chatter",
|
|
8
|
-
recordMethods: {
|
|
9
|
-
onClickLogNote() {
|
|
10
|
-
if (this.composerView && this.composerView.composer.isGateway) {
|
|
11
|
-
this.update({composerView: clear()});
|
|
12
|
-
}
|
|
13
|
-
this._super(...arguments);
|
|
14
|
-
if (this.composerView) {
|
|
15
|
-
this.composerView.composer.update({isGateway: false});
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
onClickSendMessage() {
|
|
19
|
-
if (this.composerView && this.composerView.composer.isGateway) {
|
|
20
|
-
this.update({composerView: clear()});
|
|
21
|
-
}
|
|
22
|
-
this._super(...arguments);
|
|
23
|
-
if (this.composerView) {
|
|
24
|
-
this.composerView.composer.update({isGateway: false});
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
onClickGatewayMessage() {
|
|
28
|
-
if (this.composerView && this.composerView.composer.isGateway) {
|
|
29
|
-
this.update({composerView: clear()});
|
|
30
|
-
} else {
|
|
31
|
-
this.showGatewayComposerView();
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
showGatewayComposerView() {
|
|
35
|
-
this.update({composerView: {}});
|
|
36
|
-
this.composerView.composer.update({isLog: false, isGateway: true});
|
|
37
|
-
this.focus();
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
fields: {},
|
|
41
|
-
});
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/** @odoo-module **/
|
|
2
|
-
|
|
3
|
-
import {attr, many} from "@mail/model/model_field";
|
|
4
|
-
import {clear} from "@mail/model/model_field_command";
|
|
5
|
-
import {registerPatch} from "@mail/model/model_core";
|
|
6
|
-
|
|
7
|
-
registerPatch({
|
|
8
|
-
name: "Composer",
|
|
9
|
-
fields: {
|
|
10
|
-
isGateway: attr({
|
|
11
|
-
default: false,
|
|
12
|
-
}),
|
|
13
|
-
composerGatewayFollowers: many("composerGatewayFollower", {
|
|
14
|
-
compute() {
|
|
15
|
-
if (this.thread && this.isGateway) {
|
|
16
|
-
return this.thread.followers
|
|
17
|
-
.filter(
|
|
18
|
-
(follower) => follower.partner.gateway_channels.length > 0
|
|
19
|
-
)
|
|
20
|
-
.map((follower) => {
|
|
21
|
-
return {
|
|
22
|
-
follower,
|
|
23
|
-
channel: follower.partner.gateway_channels[0].id,
|
|
24
|
-
};
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
return clear();
|
|
28
|
-
},
|
|
29
|
-
inverse: "composer",
|
|
30
|
-
}),
|
|
31
|
-
},
|
|
32
|
-
});
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/** @odoo-module **/
|
|
2
|
-
|
|
3
|
-
import {attr, one} from "@mail/model/model_field";
|
|
4
|
-
import {registerModel} from "@mail/model/model_core";
|
|
5
|
-
|
|
6
|
-
registerModel({
|
|
7
|
-
name: "composerGatewayFollower",
|
|
8
|
-
recordMethods: {
|
|
9
|
-
_getMessageData() {
|
|
10
|
-
return {
|
|
11
|
-
partner_id: this.follower.partner.id,
|
|
12
|
-
channel_type: "gateway",
|
|
13
|
-
gateway_channel_id: this.channel,
|
|
14
|
-
};
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
fields: {
|
|
18
|
-
component: attr(),
|
|
19
|
-
follower: one("Follower", {identifying: true}),
|
|
20
|
-
composer: one("Composer", {
|
|
21
|
-
identifying: true,
|
|
22
|
-
inverse: "composerGatewayFollowers",
|
|
23
|
-
}),
|
|
24
|
-
channel_type: attr({}),
|
|
25
|
-
channel: attr(),
|
|
26
|
-
hasGatewayChannels: attr({
|
|
27
|
-
compute() {
|
|
28
|
-
return this.follower.partner.gateway_channels.length > 0;
|
|
29
|
-
},
|
|
30
|
-
}),
|
|
31
|
-
},
|
|
32
|
-
});
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
/** @odoo-module **/
|
|
2
|
-
|
|
3
|
-
import {clear} from "@mail/model/model_field_command";
|
|
4
|
-
import {escapeAndCompactTextContent} from "@mail/js/utils";
|
|
5
|
-
import {one} from "@mail/model/model_field";
|
|
6
|
-
import {registerPatch} from "@mail/model/model_core";
|
|
7
|
-
|
|
8
|
-
registerPatch({
|
|
9
|
-
name: "ComposerView",
|
|
10
|
-
recordMethods: {
|
|
11
|
-
_getMessageData() {
|
|
12
|
-
var result = this._super(...arguments);
|
|
13
|
-
if (this.composer.isGateway) {
|
|
14
|
-
result.gateway_notifications =
|
|
15
|
-
this.composer.composerGatewayFollowers.map((follower) => {
|
|
16
|
-
return follower._getMessageData();
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
return result;
|
|
20
|
-
},
|
|
21
|
-
async openFullComposer() {
|
|
22
|
-
if (this.composer.isGateway) {
|
|
23
|
-
const attachmentIds = this.composer.attachments.map(
|
|
24
|
-
(attachment) => attachment.id
|
|
25
|
-
);
|
|
26
|
-
const context = {
|
|
27
|
-
default_attachment_ids: attachmentIds,
|
|
28
|
-
default_body: escapeAndCompactTextContent(
|
|
29
|
-
this.composer.textInputContent
|
|
30
|
-
),
|
|
31
|
-
default_model: this.composer.activeThread.model,
|
|
32
|
-
default_partner_ids: this.composer.recipients.map(
|
|
33
|
-
(partner) => partner.id
|
|
34
|
-
),
|
|
35
|
-
default_res_id: this.composer.activeThread.id,
|
|
36
|
-
mail_post_autofollow: this.composer.activeThread.hasWriteAccess,
|
|
37
|
-
default_wizard_partner_ids: Array.from(
|
|
38
|
-
new Set(
|
|
39
|
-
this.composer.composerGatewayFollowers.map((follower) => {
|
|
40
|
-
return follower.follower.partner.id;
|
|
41
|
-
})
|
|
42
|
-
)
|
|
43
|
-
),
|
|
44
|
-
default_wizard_channel_ids: Array.from(
|
|
45
|
-
new Set(
|
|
46
|
-
this.composer.composerGatewayFollowers.map((follower) => {
|
|
47
|
-
return follower.channel;
|
|
48
|
-
})
|
|
49
|
-
)
|
|
50
|
-
),
|
|
51
|
-
};
|
|
52
|
-
const action = {
|
|
53
|
-
type: "ir.actions.act_window",
|
|
54
|
-
name: this.env._t("Gateway message"),
|
|
55
|
-
res_model: "mail.compose.gateway.message",
|
|
56
|
-
view_mode: "form",
|
|
57
|
-
views: [[false, "form"]],
|
|
58
|
-
target: "new",
|
|
59
|
-
context: context,
|
|
60
|
-
};
|
|
61
|
-
const composer = this.composer;
|
|
62
|
-
const options = {
|
|
63
|
-
onClose: () => {
|
|
64
|
-
if (!composer.exists()) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
composer._reset();
|
|
68
|
-
if (composer.activeThread) {
|
|
69
|
-
composer.activeThread.fetchData(["messages"]);
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
await this.env.services.action.doAction(action, options);
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
return await this._super(...arguments);
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
fields: {
|
|
80
|
-
hasFollowers: {
|
|
81
|
-
compute() {
|
|
82
|
-
if (this.composer.isGateway) {
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
return this._super();
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
hasHeader: {
|
|
89
|
-
compute() {
|
|
90
|
-
return Boolean(this._super() || this.composer.isGateway);
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
composerGatewayChannelView: one("GatewayChannelView", {
|
|
94
|
-
compute() {
|
|
95
|
-
if (this.composer.isGateway) {
|
|
96
|
-
return {};
|
|
97
|
-
}
|
|
98
|
-
return clear();
|
|
99
|
-
},
|
|
100
|
-
inverse: "composerViewOwner",
|
|
101
|
-
}),
|
|
102
|
-
},
|
|
103
|
-
});
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/** @odoo-module **/
|
|
2
|
-
|
|
3
|
-
import {many} from "@mail/model/model_field";
|
|
4
|
-
import {registerPatch} from "@mail/model/model_core";
|
|
5
|
-
|
|
6
|
-
registerPatch({
|
|
7
|
-
name: "Discuss",
|
|
8
|
-
fields: {
|
|
9
|
-
/**
|
|
10
|
-
* Discuss sidebar category for `gateway` channel threads.
|
|
11
|
-
*/
|
|
12
|
-
categoryGateways: many("DiscussSidebarCategory", {
|
|
13
|
-
inverse: "discussAsGateways",
|
|
14
|
-
}),
|
|
15
|
-
},
|
|
16
|
-
recordMethods: {
|
|
17
|
-
async handleAddGatewayAutocompleteSource(req, res, gateway_id) {
|
|
18
|
-
this.discussView.update({addingChannelValue: req.term});
|
|
19
|
-
const threads = await this.messaging.models.Thread.searchGatewaysToOpen({
|
|
20
|
-
limit: 10,
|
|
21
|
-
searchTerm: req.term,
|
|
22
|
-
gateway_id,
|
|
23
|
-
});
|
|
24
|
-
const items = threads.map((thread) => {
|
|
25
|
-
const escapedName = escape(thread.name);
|
|
26
|
-
return {
|
|
27
|
-
id: thread.id,
|
|
28
|
-
label: escapedName,
|
|
29
|
-
value: escapedName,
|
|
30
|
-
gateway_id: gateway_id,
|
|
31
|
-
};
|
|
32
|
-
});
|
|
33
|
-
res(items);
|
|
34
|
-
},
|
|
35
|
-
async handleAddGatewayAutocompleteSelect(ev, ui, gateway_id) {
|
|
36
|
-
// Necessary in order to prevent AutocompleteSelect event's default
|
|
37
|
-
// behaviour as html tags visible for a split second in text area
|
|
38
|
-
ev.preventDefault();
|
|
39
|
-
const channel = this.messaging.models.Thread.insert({
|
|
40
|
-
id: ui.item.id,
|
|
41
|
-
model: "mail.channel",
|
|
42
|
-
gateway_id: gateway_id,
|
|
43
|
-
});
|
|
44
|
-
await channel.join();
|
|
45
|
-
// Channel must be pinned immediately to be able to open it before
|
|
46
|
-
// the result of join is received on the bus.
|
|
47
|
-
channel.update({isServerPinned: true});
|
|
48
|
-
channel.open();
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
});
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
/** @odoo-module **/
|
|
2
|
-
|
|
3
|
-
import {attr, one} from "@mail/model/model_field";
|
|
4
|
-
import {clear} from "@mail/model/model_field_command";
|
|
5
|
-
import {registerPatch} from "@mail/model/model_core";
|
|
6
|
-
|
|
7
|
-
registerPatch({
|
|
8
|
-
name: "DiscussSidebarCategory",
|
|
9
|
-
fields: {
|
|
10
|
-
gateway_id: attr({identifying: true}),
|
|
11
|
-
gateway: one("Gateway", {inverse: "categories"}),
|
|
12
|
-
discussAsGateways: one("Discuss", {
|
|
13
|
-
inverse: "categoryGateways",
|
|
14
|
-
}),
|
|
15
|
-
hasAddCommand: {
|
|
16
|
-
compute() {
|
|
17
|
-
if (this.gateway_id) {
|
|
18
|
-
return true;
|
|
19
|
-
}
|
|
20
|
-
return this._super();
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
activeItem: {
|
|
24
|
-
compute() {
|
|
25
|
-
// We need to adapt this function to refresh the right category only
|
|
26
|
-
const channel =
|
|
27
|
-
this.messaging.discuss.activeThread &&
|
|
28
|
-
this.messaging.discuss.activeThread.channel;
|
|
29
|
-
if (
|
|
30
|
-
channel &&
|
|
31
|
-
this.gateway_id &&
|
|
32
|
-
this.supportedChannelTypes.includes(channel.channel_type) &&
|
|
33
|
-
channel.thread.gateway_id !== this.gateway_id
|
|
34
|
-
) {
|
|
35
|
-
return clear();
|
|
36
|
-
}
|
|
37
|
-
return this._super();
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
autocompleteMethod: {
|
|
41
|
-
compute() {
|
|
42
|
-
if (this.gateway_id) {
|
|
43
|
-
return "gateway";
|
|
44
|
-
}
|
|
45
|
-
return this._super();
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
newItemPlaceholderText: {
|
|
49
|
-
compute() {
|
|
50
|
-
if (this.gateway_id) {
|
|
51
|
-
return this.env._t("Find a gateway channel...");
|
|
52
|
-
}
|
|
53
|
-
return this._super();
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
isServerOpen: {
|
|
57
|
-
compute() {
|
|
58
|
-
// There is no server state for non-users (guests)
|
|
59
|
-
if (!this.messaging.currentUser) {
|
|
60
|
-
return clear();
|
|
61
|
-
}
|
|
62
|
-
if (!this.messaging.currentUser.res_users_settings_id) {
|
|
63
|
-
return clear();
|
|
64
|
-
}
|
|
65
|
-
if (this.gateway_id) {
|
|
66
|
-
return true;
|
|
67
|
-
}
|
|
68
|
-
return this._super();
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
name: {
|
|
72
|
-
compute() {
|
|
73
|
-
if (this.gateway_id) {
|
|
74
|
-
return this.gateway.name;
|
|
75
|
-
}
|
|
76
|
-
return this._super();
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
categoryItemsOrderedByLastAction: {
|
|
81
|
-
compute() {
|
|
82
|
-
if (this.gateway_id) {
|
|
83
|
-
return this.categoryItems;
|
|
84
|
-
}
|
|
85
|
-
return this._super();
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
orderedCategoryItems: {
|
|
89
|
-
compute() {
|
|
90
|
-
if (this.gateway_id) {
|
|
91
|
-
return this.categoryItemsOrderedByLastAction;
|
|
92
|
-
}
|
|
93
|
-
return this._super();
|
|
94
|
-
},
|
|
95
|
-
},
|
|
96
|
-
supportedChannelTypes: {
|
|
97
|
-
compute() {
|
|
98
|
-
if (this.gateway_id) {
|
|
99
|
-
return ["gateway"];
|
|
100
|
-
}
|
|
101
|
-
return this._super();
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
recordMethods: {
|
|
106
|
-
onAddItemAutocompleteSource(req, res) {
|
|
107
|
-
if (this.autocompleteMethod === "gateway") {
|
|
108
|
-
this.messaging.discuss.handleAddGatewayAutocompleteSource(
|
|
109
|
-
req,
|
|
110
|
-
res,
|
|
111
|
-
this.gateway_id
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
return this._super(...arguments);
|
|
115
|
-
},
|
|
116
|
-
|
|
117
|
-
onAddItemAutocompleteSelect(ev, ui) {
|
|
118
|
-
if (this.autocompleteMethod === "gateway") {
|
|
119
|
-
return this.messaging.discuss.handleAddGatewayAutocompleteSelect(
|
|
120
|
-
ev,
|
|
121
|
-
ui,
|
|
122
|
-
this.gateway_id
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
return this._super(...arguments);
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
});
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/** @odoo-module **/
|
|
2
|
-
|
|
3
|
-
import {clear} from "@mail/model/model_field_command";
|
|
4
|
-
import {registerPatch} from "@mail/model/model_core";
|
|
5
|
-
|
|
6
|
-
registerPatch({
|
|
7
|
-
name: "DiscussSidebarCategoryItem",
|
|
8
|
-
fields: {
|
|
9
|
-
avatarUrl: {
|
|
10
|
-
compute() {
|
|
11
|
-
// We will use the avatar provied by the channel by default
|
|
12
|
-
if (this.channel.channel_type === "gateway") {
|
|
13
|
-
return `/web/image/mail.channel/${this.channel.id}/avatar_128?unique=${this.channel.avatarCacheKey}`;
|
|
14
|
-
}
|
|
15
|
-
return this._super();
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
categoryCounterContribution: {
|
|
19
|
-
compute() {
|
|
20
|
-
if (this.channel.channel_type === "gateway") {
|
|
21
|
-
return this.channel.localMessageUnreadCounter > 0 ? 1 : 0;
|
|
22
|
-
}
|
|
23
|
-
return this._super();
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
counter: {
|
|
27
|
-
compute() {
|
|
28
|
-
if (this.channel.channel_type === "gateway") {
|
|
29
|
-
return this.channel.localMessageUnreadCounter;
|
|
30
|
-
}
|
|
31
|
-
return this._super();
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
hasThreadIcon: {
|
|
35
|
-
compute() {
|
|
36
|
-
if (this.channel.channel_type === "gateway") {
|
|
37
|
-
return clear();
|
|
38
|
-
}
|
|
39
|
-
return this._super();
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
hasUnpinCommand: {
|
|
43
|
-
compute() {
|
|
44
|
-
if (this.channel.channel_type === "gateway") {
|
|
45
|
-
return !this.channel.localMessageUnreadCounter;
|
|
46
|
-
}
|
|
47
|
-
return this._super();
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/** @odoo-module **/
|
|
2
|
-
|
|
3
|
-
import {attr, one} from "@mail/model/model_field";
|
|
4
|
-
import {registerModel} from "@mail/model/model_core";
|
|
5
|
-
|
|
6
|
-
registerModel({
|
|
7
|
-
name: "GatewayChannelView",
|
|
8
|
-
fields: {
|
|
9
|
-
component: attr(),
|
|
10
|
-
composerViewOwner: one("ComposerView", {
|
|
11
|
-
identifying: true,
|
|
12
|
-
inverse: "composerGatewayChannelView",
|
|
13
|
-
}),
|
|
14
|
-
},
|
|
15
|
-
});
|