odoo-addon-mail-gateway 16.0.1.2.0__py3-none-any.whl → 17.0.1.0.0.2__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 +36 -25
- odoo/addons/mail_gateway/__init__.py +0 -1
- odoo/addons/mail_gateway/__manifest__.py +6 -14
- odoo/addons/mail_gateway/controllers/discuss.py +2 -2
- odoo/addons/mail_gateway/controllers/gateway.py +3 -0
- odoo/addons/mail_gateway/hooks.py +3 -3
- odoo/addons/mail_gateway/i18n/es.po +6 -309
- odoo/addons/mail_gateway/i18n/it.po +5 -336
- odoo/addons/mail_gateway/i18n/mail_gateway.pot +149 -84
- odoo/addons/mail_gateway/models/__init__.py +4 -3
- odoo/addons/mail_gateway/models/{mail_channel.py → discuss_channel.py} +30 -8
- odoo/addons/mail_gateway/models/ir_websocket.py +1 -1
- odoo/addons/mail_gateway/models/mail_gateway.py +4 -4
- odoo/addons/mail_gateway/models/mail_gateway_abstract.py +2 -2
- odoo/addons/mail_gateway/models/mail_message.py +9 -8
- odoo/addons/mail_gateway/models/mail_notification.py +3 -3
- odoo/addons/mail_gateway/models/mail_thread.py +39 -7
- odoo/addons/mail_gateway/models/res_partner.py +10 -18
- odoo/addons/mail_gateway/models/res_users.py +0 -1
- odoo/addons/mail_gateway/models/res_users_settings.py +12 -0
- odoo/addons/mail_gateway/readme/CONTRIBUTORS.md +2 -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/USAGE.md +12 -0
- odoo/addons/mail_gateway/security/ir.model.access.csv +4 -2
- odoo/addons/mail_gateway/security/security.xml +9 -9
- odoo/addons/mail_gateway/static/description/index.html +39 -26
- odoo/addons/mail_gateway/static/src/components/chatter/chatter.esm.js +15 -0
- odoo/addons/mail_gateway/static/src/components/chatter/chatter.xml +36 -22
- odoo/addons/mail_gateway/static/src/components/composer/composer.esm.js +108 -0
- odoo/addons/mail_gateway/static/src/components/gateway_follower/gateway_follower.esm.js +35 -22
- 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 +23 -0
- odoo/addons/mail_gateway/static/src/core/common/discuss_app_model_patch.esm.js +31 -0
- odoo/addons/mail_gateway/static/src/core/common/message_actions.esm.js +23 -0
- odoo/addons/mail_gateway/static/src/core/common/message_model_patch.esm.js +21 -0
- odoo/addons/mail_gateway/static/src/core/common/notification_model_patch.esm.js +35 -0
- odoo/addons/mail_gateway/static/src/core/common/persona_model_patch.esm.js +12 -0
- odoo/addons/mail_gateway/static/src/core/common/store_service_patch.esm.js +14 -0
- odoo/addons/mail_gateway/static/src/core/common/thread_model_patch.esm.js +49 -0
- odoo/addons/mail_gateway/static/src/core/common/thread_service_patch.esm.js +19 -0
- odoo/addons/mail_gateway/static/src/core/web/discuss_app_category_model_patch.esm.js +21 -0
- odoo/addons/mail_gateway/static/src/core/web/discuss_sidebar_categories.esm.js +16 -0
- odoo/addons/mail_gateway/static/src/core/web/discuss_sidebar_category_item_patch.xml +12 -0
- odoo/addons/mail_gateway/static/src/core/web/gateway_core_web_service.esm.js +40 -0
- odoo/addons/mail_gateway/static/src/models/gateway.esm.js +21 -14
- odoo/addons/mail_gateway/static/src/models/gateway_channel.esm.js +21 -13
- odoo/addons/mail_gateway/static/src/models/gateway_follower.esm.js +24 -0
- odoo/addons/mail_gateway/views/mail_gateway.xml +4 -4
- odoo/addons/mail_gateway/views/mail_guest_views.xml +15 -0
- odoo/addons/mail_gateway/wizards/mail_compose_gateway_message.py +19 -4
- odoo/addons/mail_gateway/wizards/mail_compose_gateway_message.xml +1 -2
- odoo/addons/mail_gateway/wizards/mail_guest_manage.py +2 -3
- odoo/addons/mail_gateway/wizards/mail_guest_manage.xml +2 -2
- odoo/addons/mail_gateway/wizards/mail_message_gateway_link.py +0 -1
- odoo/addons/mail_gateway/wizards/mail_message_gateway_send.py +0 -1
- {odoo_addon_mail_gateway-16.0.1.2.0.dist-info → odoo_addon_mail_gateway-17.0.1.0.0.2.dist-info}/METADATA +43 -31
- odoo_addon_mail_gateway-17.0.1.0.0.2.dist-info/RECORD +74 -0
- {odoo_addon_mail_gateway-16.0.1.2.0.dist-info → odoo_addon_mail_gateway-17.0.1.0.0.2.dist-info}/WHEEL +1 -1
- odoo_addon_mail_gateway-17.0.1.0.0.2.dist-info/top_level.txt +1 -0
- 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.2.0.dist-info/RECORD +0 -77
- odoo_addon_mail_gateway-16.0.1.2.0.dist-info/top_level.txt +0 -1
|
@@ -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
|
-
});
|
|
@@ -1,76 +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: "Message",
|
|
9
|
-
fields: {
|
|
10
|
-
gateway_type: attr(),
|
|
11
|
-
gateway_channel_data: attr(),
|
|
12
|
-
gateway_thread_data: attr(),
|
|
13
|
-
gatewayThread: one("Thread", {
|
|
14
|
-
compute() {
|
|
15
|
-
if (
|
|
16
|
-
this.gateway_thread_data &&
|
|
17
|
-
Object.keys(this.gateway_thread_data).length > 0
|
|
18
|
-
) {
|
|
19
|
-
return this.gateway_thread_data;
|
|
20
|
-
}
|
|
21
|
-
return clear();
|
|
22
|
-
},
|
|
23
|
-
inverse: "messagesAsGatewayThread",
|
|
24
|
-
}),
|
|
25
|
-
canBeDeleted: {
|
|
26
|
-
compute() {
|
|
27
|
-
if (
|
|
28
|
-
this.originThread &&
|
|
29
|
-
this.originThread.model !== "mail.channel" &&
|
|
30
|
-
this.gateway_type
|
|
31
|
-
) {
|
|
32
|
-
return true;
|
|
33
|
-
}
|
|
34
|
-
if (
|
|
35
|
-
this.originThread &&
|
|
36
|
-
this.originThread.model === "mail.channel" &&
|
|
37
|
-
this.gateway_type
|
|
38
|
-
) {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
return this._super();
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
modelMethods: {
|
|
46
|
-
convertData(data) {
|
|
47
|
-
const data2 = this._super(data);
|
|
48
|
-
data2.gateway_type = data.gateway_type;
|
|
49
|
-
data2.gateway_channel_data = data.gateway_channel_data;
|
|
50
|
-
data2.gateway_thread_data = data.gateway_thread_data;
|
|
51
|
-
return data2;
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
recordMethods: {
|
|
55
|
-
/**
|
|
56
|
-
* @private
|
|
57
|
-
*/
|
|
58
|
-
_computeGatewayData() {
|
|
59
|
-
if (
|
|
60
|
-
this.gateway_thread_data &&
|
|
61
|
-
Object.keys(this.gateway_thread_data).length > 0
|
|
62
|
-
) {
|
|
63
|
-
this.update({gatewayThread: this.gateway_thread_data});
|
|
64
|
-
} else {
|
|
65
|
-
this.update({gatewayThread: clear()});
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
|
|
70
|
-
onChanges: [
|
|
71
|
-
{
|
|
72
|
-
dependencies: ["gateway_thread_data"],
|
|
73
|
-
methodName: "_computeGatewayData",
|
|
74
|
-
},
|
|
75
|
-
],
|
|
76
|
-
});
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/** @odoo-module **/
|
|
2
|
-
import {one} from "@mail/model/model_field";
|
|
3
|
-
import {registerPatch} from "@mail/model/model_core";
|
|
4
|
-
|
|
5
|
-
registerPatch({
|
|
6
|
-
name: "MessageAction",
|
|
7
|
-
fields: {
|
|
8
|
-
messageActionListOwnerAsSendGateway: one("MessageActionList", {
|
|
9
|
-
identifying: true,
|
|
10
|
-
inverse: "actionSendGateway",
|
|
11
|
-
}),
|
|
12
|
-
messageActionListOwnerAsAddToThread: one("MessageActionList", {
|
|
13
|
-
identifying: true,
|
|
14
|
-
inverse: "actionAddToThread",
|
|
15
|
-
}),
|
|
16
|
-
sequence: {
|
|
17
|
-
compute() {
|
|
18
|
-
if (
|
|
19
|
-
this.messageActionListOwner ===
|
|
20
|
-
this.messageActionListOwnerAsSendGateway
|
|
21
|
-
) {
|
|
22
|
-
return 7;
|
|
23
|
-
}
|
|
24
|
-
if (
|
|
25
|
-
this.messageActionListOwner ===
|
|
26
|
-
this.messageActionListOwnerAsAddToThread
|
|
27
|
-
) {
|
|
28
|
-
return 8;
|
|
29
|
-
}
|
|
30
|
-
return this._super();
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
messageActionListOwner: {
|
|
34
|
-
compute() {
|
|
35
|
-
if (this.messageActionListOwnerAsSendGateway) {
|
|
36
|
-
return this.messageActionListOwnerAsSendGateway;
|
|
37
|
-
}
|
|
38
|
-
if (this.messageActionListOwnerAsAddToThread) {
|
|
39
|
-
return this.messageActionListOwnerAsAddToThread;
|
|
40
|
-
}
|
|
41
|
-
return this._super();
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
});
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/** @odoo-module **/
|
|
2
|
-
import {clear} from "@mail/model/model_field_command";
|
|
3
|
-
import {one} from "@mail/model/model_field";
|
|
4
|
-
import {registerPatch} from "@mail/model/model_core";
|
|
5
|
-
|
|
6
|
-
registerPatch({
|
|
7
|
-
name: "MessageActionList",
|
|
8
|
-
fields: {
|
|
9
|
-
actionSendGateway: one("MessageAction", {
|
|
10
|
-
compute() {
|
|
11
|
-
if (
|
|
12
|
-
this.message &&
|
|
13
|
-
this.message.gateway_channel_data &&
|
|
14
|
-
this.message.gateway_channel_data.partners &&
|
|
15
|
-
Object.keys(this.message.gateway_channel_data.partners).length
|
|
16
|
-
) {
|
|
17
|
-
return {};
|
|
18
|
-
}
|
|
19
|
-
return clear();
|
|
20
|
-
},
|
|
21
|
-
inverse: "messageActionListOwnerAsSendGateway",
|
|
22
|
-
}),
|
|
23
|
-
actionAddToThread: one("MessageAction", {
|
|
24
|
-
compute() {
|
|
25
|
-
if (
|
|
26
|
-
this.message.gateway_type &&
|
|
27
|
-
!this.message.gatewayThread &&
|
|
28
|
-
this.message.originThread.model === "mail.channel"
|
|
29
|
-
) {
|
|
30
|
-
return {};
|
|
31
|
-
}
|
|
32
|
-
return clear();
|
|
33
|
-
},
|
|
34
|
-
inverse: "messageActionListOwnerAsAddToThread",
|
|
35
|
-
}),
|
|
36
|
-
},
|
|
37
|
-
});
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/** @odoo-module **/
|
|
2
|
-
import {registerPatch} from "@mail/model/model_core";
|
|
3
|
-
|
|
4
|
-
registerPatch({
|
|
5
|
-
name: "MessageActionView",
|
|
6
|
-
recordMethods: {
|
|
7
|
-
onClick(ev) {
|
|
8
|
-
if (
|
|
9
|
-
this.messageAction.messageActionListOwner ===
|
|
10
|
-
this.messageAction.messageActionListOwnerAsSendGateway
|
|
11
|
-
) {
|
|
12
|
-
ev.stopPropagation();
|
|
13
|
-
this.env.services.action.doAction({
|
|
14
|
-
name: this.env._t("Send with gateway"),
|
|
15
|
-
type: "ir.actions.act_window",
|
|
16
|
-
res_model: "mail.message.gateway.send",
|
|
17
|
-
context: {
|
|
18
|
-
...this.messageAction.messageActionListOwner.message
|
|
19
|
-
.gateway_channel_data,
|
|
20
|
-
default_message_id:
|
|
21
|
-
this.messageAction.messageActionListOwner.message.id,
|
|
22
|
-
},
|
|
23
|
-
views: [[false, "form"]],
|
|
24
|
-
target: "new",
|
|
25
|
-
});
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
if (
|
|
29
|
-
this.messageAction.messageActionListOwner ===
|
|
30
|
-
this.messageAction.messageActionListOwnerAsAddToThread
|
|
31
|
-
) {
|
|
32
|
-
ev.stopPropagation();
|
|
33
|
-
this.env.services.action.doAction({
|
|
34
|
-
name: this.env._t("Link Message to thread"),
|
|
35
|
-
type: "ir.actions.act_window",
|
|
36
|
-
res_model: "mail.message.gateway.link",
|
|
37
|
-
context: {
|
|
38
|
-
default_message_id:
|
|
39
|
-
this.messageAction.messageActionListOwner.message.id,
|
|
40
|
-
},
|
|
41
|
-
views: [[false, "form"]],
|
|
42
|
-
target: "new",
|
|
43
|
-
});
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
return this._super(...arguments);
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
fields: {
|
|
50
|
-
title: {
|
|
51
|
-
compute() {
|
|
52
|
-
if (
|
|
53
|
-
this.messageAction.messageActionListOwner ===
|
|
54
|
-
this.messageAction.messageActionListOwnerAsSendGateway
|
|
55
|
-
) {
|
|
56
|
-
return this.env._t("Send with gateway");
|
|
57
|
-
}
|
|
58
|
-
if (
|
|
59
|
-
this.messageAction.messageActionListOwner ===
|
|
60
|
-
this.messageAction.messageActionListOwnerAsAddToThread
|
|
61
|
-
) {
|
|
62
|
-
return this.env._t("Link to thread");
|
|
63
|
-
}
|
|
64
|
-
return this._super();
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
classNames: {
|
|
68
|
-
compute() {
|
|
69
|
-
if (
|
|
70
|
-
this.messageAction.messageActionListOwner ===
|
|
71
|
-
this.messageAction.messageActionListOwnerAsSendGateway
|
|
72
|
-
) {
|
|
73
|
-
return (
|
|
74
|
-
this.paddingClassNames +
|
|
75
|
-
" fa fa-lg fa-share-square-o o_MessageActionView_actionSendGateway"
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
if (
|
|
79
|
-
this.messageAction.messageActionListOwner ===
|
|
80
|
-
this.messageAction.messageActionListOwnerAsAddToThread
|
|
81
|
-
) {
|
|
82
|
-
return (
|
|
83
|
-
this.paddingClassNames +
|
|
84
|
-
" fa fa-lg fa-link o_MessageActionView_actionAddToThread"
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
return this._super();
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/** @odoo-module **/
|
|
2
|
-
|
|
3
|
-
import {registerPatch} from "@mail/model/model_core";
|
|
4
|
-
|
|
5
|
-
registerPatch({
|
|
6
|
-
name: "MessagingInitializer",
|
|
7
|
-
recordMethods: {
|
|
8
|
-
async _init({gateways}) {
|
|
9
|
-
const discuss = this.messaging.discuss;
|
|
10
|
-
if (gateways) {
|
|
11
|
-
this.messaging.executeGracefully(
|
|
12
|
-
gateways.map((gatewayData) => () => {
|
|
13
|
-
this.messaging.models.DiscussSidebarCategory.insert({
|
|
14
|
-
discussAsGateways: discuss,
|
|
15
|
-
gateway: gatewayData,
|
|
16
|
-
gateway_id: gatewayData.id,
|
|
17
|
-
});
|
|
18
|
-
})
|
|
19
|
-
);
|
|
20
|
-
}
|
|
21
|
-
this._super(...arguments);
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/** @odoo-module **/
|
|
2
|
-
|
|
3
|
-
import {attr} from "@mail/model/model_field";
|
|
4
|
-
import {registerPatch} from "@mail/model/model_core";
|
|
5
|
-
|
|
6
|
-
registerPatch({
|
|
7
|
-
name: "Notification",
|
|
8
|
-
modelMethods: {
|
|
9
|
-
convertData(data) {
|
|
10
|
-
var data2 = this._super(data);
|
|
11
|
-
data2.gateway_type = data.gateway_type;
|
|
12
|
-
data2.channel_name = data.channel_name;
|
|
13
|
-
return data2;
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
fields: {
|
|
17
|
-
channel_name: attr(),
|
|
18
|
-
gateway_type: attr(),
|
|
19
|
-
},
|
|
20
|
-
});
|