odoo-addon-mail-gateway 16.0.1.3.0__py3-none-any.whl → 17.0.1.0.1__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.

Files changed (91) hide show
  1. odoo/addons/mail_gateway/README.rst +31 -24
  2. odoo/addons/mail_gateway/__init__.py +0 -1
  3. odoo/addons/mail_gateway/__manifest__.py +6 -14
  4. odoo/addons/mail_gateway/controllers/discuss.py +2 -2
  5. odoo/addons/mail_gateway/controllers/gateway.py +3 -0
  6. odoo/addons/mail_gateway/hooks.py +3 -3
  7. odoo/addons/mail_gateway/i18n/es.po +68 -406
  8. odoo/addons/mail_gateway/i18n/it.po +5 -336
  9. odoo/addons/mail_gateway/i18n/mail_gateway.pot +149 -84
  10. odoo/addons/mail_gateway/models/__init__.py +4 -3
  11. odoo/addons/mail_gateway/models/{mail_channel.py → discuss_channel.py} +30 -8
  12. odoo/addons/mail_gateway/models/ir_websocket.py +1 -1
  13. odoo/addons/mail_gateway/models/mail_gateway.py +4 -4
  14. odoo/addons/mail_gateway/models/mail_gateway_abstract.py +2 -2
  15. odoo/addons/mail_gateway/models/mail_message.py +9 -8
  16. odoo/addons/mail_gateway/models/mail_notification.py +3 -3
  17. odoo/addons/mail_gateway/models/mail_thread.py +40 -8
  18. odoo/addons/mail_gateway/models/res_partner.py +10 -18
  19. odoo/addons/mail_gateway/models/res_users.py +0 -1
  20. odoo/addons/mail_gateway/models/res_users_settings.py +12 -0
  21. odoo/addons/mail_gateway/readme/CONTRIBUTORS.md +2 -0
  22. odoo/addons/mail_gateway/readme/{CREDITS.rst → CREDITS.md} +2 -1
  23. odoo/addons/mail_gateway/readme/DESCRIPTION.md +8 -0
  24. odoo/addons/mail_gateway/readme/USAGE.md +12 -0
  25. odoo/addons/mail_gateway/security/ir.model.access.csv +4 -2
  26. odoo/addons/mail_gateway/security/security.xml +9 -9
  27. odoo/addons/mail_gateway/static/description/index.html +23 -16
  28. odoo/addons/mail_gateway/static/src/components/chatter/chatter.esm.js +15 -0
  29. odoo/addons/mail_gateway/static/src/components/chatter/chatter.xml +36 -22
  30. odoo/addons/mail_gateway/static/src/components/composer/composer.esm.js +108 -0
  31. odoo/addons/mail_gateway/static/src/components/gateway_follower/gateway_follower.esm.js +35 -22
  32. odoo/addons/mail_gateway/static/src/components/gateway_follower/gateway_follower.xml +3 -5
  33. odoo/addons/mail_gateway/static/src/components/message/message.xml +15 -15
  34. odoo/addons/mail_gateway/static/src/components/message/message_patch.esm.js +67 -0
  35. odoo/addons/mail_gateway/static/src/components/message_notification_popover_content/message_notification_popover_content.xml +3 -7
  36. odoo/addons/mail_gateway/static/src/core/common/composer_model_patch.esm.js +23 -0
  37. odoo/addons/mail_gateway/static/src/core/common/discuss_app_model_patch.esm.js +31 -0
  38. odoo/addons/mail_gateway/static/src/core/common/message_actions.esm.js +23 -0
  39. odoo/addons/mail_gateway/static/src/core/common/message_model_patch.esm.js +21 -0
  40. odoo/addons/mail_gateway/static/src/core/common/notification_model_patch.esm.js +35 -0
  41. odoo/addons/mail_gateway/static/src/core/common/persona_model_patch.esm.js +12 -0
  42. odoo/addons/mail_gateway/static/src/core/common/store_service_patch.esm.js +14 -0
  43. odoo/addons/mail_gateway/static/src/core/common/thread_model_patch.esm.js +49 -0
  44. odoo/addons/mail_gateway/static/src/core/common/thread_service_patch.esm.js +19 -0
  45. odoo/addons/mail_gateway/static/src/core/web/discuss_app_category_model_patch.esm.js +21 -0
  46. odoo/addons/mail_gateway/static/src/core/web/discuss_sidebar_categories.esm.js +16 -0
  47. odoo/addons/mail_gateway/static/src/core/web/discuss_sidebar_category_item_patch.xml +12 -0
  48. odoo/addons/mail_gateway/static/src/core/web/gateway_core_web_service.esm.js +40 -0
  49. odoo/addons/mail_gateway/static/src/models/gateway.esm.js +21 -14
  50. odoo/addons/mail_gateway/static/src/models/gateway_channel.esm.js +21 -13
  51. odoo/addons/mail_gateway/static/src/models/gateway_follower.esm.js +24 -0
  52. odoo/addons/mail_gateway/views/mail_gateway.xml +4 -4
  53. odoo/addons/mail_gateway/views/mail_guest_views.xml +15 -0
  54. odoo/addons/mail_gateway/wizards/mail_compose_gateway_message.py +19 -4
  55. odoo/addons/mail_gateway/wizards/mail_compose_gateway_message.xml +1 -2
  56. odoo/addons/mail_gateway/wizards/mail_guest_manage.py +2 -3
  57. odoo/addons/mail_gateway/wizards/mail_guest_manage.xml +2 -2
  58. odoo/addons/mail_gateway/wizards/mail_message_gateway_link.py +1 -2
  59. odoo/addons/mail_gateway/wizards/mail_message_gateway_send.py +0 -1
  60. {odoo_addon_mail_gateway-16.0.1.3.0.dist-info → odoo_addon_mail_gateway-17.0.1.0.1.dist-info}/METADATA +38 -30
  61. odoo_addon_mail_gateway-17.0.1.0.1.dist-info/RECORD +74 -0
  62. {odoo_addon_mail_gateway-16.0.1.3.0.dist-info → odoo_addon_mail_gateway-17.0.1.0.1.dist-info}/WHEEL +1 -1
  63. odoo_addon_mail_gateway-17.0.1.0.1.dist-info/top_level.txt +1 -0
  64. odoo/addons/mail_gateway/i18n/es_VE.po +0 -879
  65. odoo/addons/mail_gateway/readme/CONTRIBUTORS.rst +0 -2
  66. odoo/addons/mail_gateway/readme/DESCRIPTION.rst +0 -5
  67. odoo/addons/mail_gateway/readme/USAGE.rst +0 -9
  68. odoo/addons/mail_gateway/static/src/components/composer/composer.xml +0 -24
  69. odoo/addons/mail_gateway/static/src/components/discuss_sidebar/discuss_sidebar.xml +0 -17
  70. odoo/addons/mail_gateway/static/src/models/channel.esm.js +0 -33
  71. odoo/addons/mail_gateway/static/src/models/channel_member_view.esm.js +0 -39
  72. odoo/addons/mail_gateway/static/src/models/chatter.esm.js +0 -41
  73. odoo/addons/mail_gateway/static/src/models/composer.esm.js +0 -32
  74. odoo/addons/mail_gateway/static/src/models/composer_gateway_follower.esm.js +0 -32
  75. odoo/addons/mail_gateway/static/src/models/composer_view.esm.js +0 -103
  76. odoo/addons/mail_gateway/static/src/models/discuss.esm.js +0 -51
  77. odoo/addons/mail_gateway/static/src/models/discuss_sidebar_category.esm.js +0 -128
  78. odoo/addons/mail_gateway/static/src/models/discuss_sidebar_category_item.esm.js +0 -51
  79. odoo/addons/mail_gateway/static/src/models/gateway_channel_view.esm.js +0 -15
  80. odoo/addons/mail_gateway/static/src/models/guest.esm.js +0 -10
  81. odoo/addons/mail_gateway/static/src/models/message.esm.js +0 -76
  82. odoo/addons/mail_gateway/static/src/models/message_action.esm.js +0 -45
  83. odoo/addons/mail_gateway/static/src/models/message_action_list.esm.js +0 -37
  84. odoo/addons/mail_gateway/static/src/models/message_action_view.esm.js +0 -91
  85. odoo/addons/mail_gateway/static/src/models/message_view.esm.js +0 -13
  86. odoo/addons/mail_gateway/static/src/models/messaging_initializer.esm.js +0 -24
  87. odoo/addons/mail_gateway/static/src/models/notification.esm.js +0 -20
  88. odoo/addons/mail_gateway/static/src/models/partner.esm.js +0 -11
  89. odoo/addons/mail_gateway/static/src/models/thread.esm.js +0 -77
  90. odoo_addon_mail_gateway-16.0.1.3.0.dist-info/RECORD +0 -78
  91. odoo_addon_mail_gateway-16.0.1.3.0.dist-info/top_level.txt +0 -1
@@ -1,27 +1,25 @@
1
1
  <?xml version="1.0" encoding="UTF-8" ?>
2
2
  <templates xml:space="preserve">
3
- <t t-name="mail_gateway.GatewayFollowerView" owl="1">
3
+ <t t-name="mail_gateway.GatewayFollowerView">
4
4
  <div class="o_gateway_composer_selector">
5
5
  <span
6
6
  class="o_gateway_composer_selector_partner"
7
- t-esc="composerGatewayFollower.follower.partner.persona.name"
7
+ t-esc="composerGatewayFollower.name"
8
8
  />
9
9
  <select
10
10
  name="gatewayChannel"
11
11
  class="o_input o_gateway_composer_selector_channel"
12
- t-att-value="composerGatewayFollower.channel"
13
12
  t-on-change="onChangeGatewayChannel"
14
13
  >
15
14
  <option value="">Not selected</option>
16
15
  <t
17
- t-foreach="composerGatewayFollower.follower.partner.gateway_channels"
16
+ t-foreach="composerGatewayFollower.gateway_channels"
18
17
  t-as="gateway_channel"
19
18
  t-key="gateway_channel.id"
20
19
  >
21
20
  <option
22
21
  t-att-value="gateway_channel.id"
23
22
  t-esc="gateway_channel.name"
24
- t-att-selected="gateway_channel.id === composerGatewayFollower.channel"
25
23
  />
26
24
  </t>
27
25
  </select>
@@ -2,21 +2,21 @@
2
2
  <templates xml:space="preserve">
3
3
 
4
4
  <t t-inherit="mail.Message" t-inherit-mode="extension">
5
- <xpath expr="//small[hasclass('o_Message_originThread')]/.." position="after">
6
- <t t-if="messageView.message.gatewayThread">
7
- <small
8
- class="o_Message_originThread me-2"
9
- t-att-class="{ 'o-message-selected text-600': messageView.isSelected, 'text-500': !messageView.isSelected }"
10
- >
11
- on <a
12
- class="o_Message_originThreadLink fs-6"
13
- t-att-href="messageView.message.gatewayThread.url"
14
- t-on-click="messageView.onClickGatewayThread"
15
- ><t t-if="messageView.message.gatewayThread.displayName"><t
16
- t-esc="messageView.message.gatewayThread.displayName"
17
- /></t><t t-else="">document</t></a>
18
- </small>
19
- </t>
5
+ <xpath
6
+ expr="//small[@t-if='isPersistentMessageFromAnotherThread']"
7
+ position="after"
8
+ >
9
+ <small
10
+ t-if="message.gateway_thread_data"
11
+ t-on-click.prevent="openGatewayThreadRecord"
12
+ class="ms-1 text-500"
13
+ >
14
+ <t t-if="message.gateway_thread_data.model !== 'discuss.channel'">
15
+ on <a t-att-href="message.resUrl"><t
16
+ t-esc="message.gateway_thread_data?.name"
17
+ /></a>
18
+ </t>
19
+ </small>
20
20
  </xpath>
21
21
  </t>
22
22
  </templates>
@@ -0,0 +1,67 @@
1
+ /* @odoo-module */
2
+ import {_t} from "@web/core/l10n/translation";
3
+ import {Message} from "@mail/core/common/message";
4
+ import {patch} from "@web/core/utils/patch";
5
+
6
+ patch(Message.prototype, {
7
+ hasAuthorClickable() {
8
+ if (
9
+ this.message.gateway_type &&
10
+ this.message.author?.type === "guest" &&
11
+ this.message.author.id
12
+ ) {
13
+ return true;
14
+ }
15
+ return super.hasAuthorClickable();
16
+ },
17
+ getAuthorText() {
18
+ if (this.hasAuthorClickable() && this.message.gateway_type) {
19
+ return _t("Create partner");
20
+ }
21
+ return super.getAuthorText();
22
+ },
23
+ onClickAuthor(ev) {
24
+ if (this.message.gateway_type && this.hasAuthorClickable()) {
25
+ ev.stopPropagation();
26
+ return this.env.services.action.doAction({
27
+ name: _t("Manage guest"),
28
+ type: "ir.actions.act_window",
29
+ res_model: "mail.guest.manage",
30
+ context: {default_guest_id: this.message.author.id},
31
+ views: [[false, "form"]],
32
+ target: "new",
33
+ });
34
+ }
35
+ return super.onClickAuthor(...arguments);
36
+ },
37
+ onClickLinkGatewayToThread() {
38
+ this.env.services.action.doAction({
39
+ name: _t("Link Message to thread"),
40
+ type: "ir.actions.act_window",
41
+ res_model: "mail.message.gateway.link",
42
+ context: {default_message_id: this.message.id},
43
+ views: [[false, "form"]],
44
+ target: "new",
45
+ });
46
+ },
47
+ onClickSendWithGateway() {
48
+ this.env.services.action.doAction({
49
+ name: _t("Send with gateway"),
50
+ type: "ir.actions.act_window",
51
+ res_model: "mail.message.gateway.send",
52
+ context: {
53
+ ...this.props.message.gateway_channel_data,
54
+ default_message_id: this.props.message.id,
55
+ },
56
+ views: [[false, "form"]],
57
+ target: "new",
58
+ });
59
+ },
60
+ openGatewayThreadRecord() {
61
+ const gateway_thread = this.threadService.getThread(
62
+ this.message.gateway_thread_data.model,
63
+ this.message.gateway_thread_data.id
64
+ );
65
+ this.threadService.open(gateway_thread);
66
+ },
67
+ });
@@ -1,14 +1,10 @@
1
1
  <?xml version="1.0" encoding="UTF-8" ?>
2
2
  <templates xml:space="preserve">
3
- <t t-inherit="mail.MessageNotificationPopoverContent" t-inherit-mode="extension">
4
- <xpath
5
- expr="//div[hasclass('o_MessageNotificationPopoverContent_notification')]"
6
- position="inside"
7
- >
3
+ <t t-inherit="mail.MessageNotificationPopover" t-inherit-mode="extension">
4
+ <xpath expr="//span[@t-if='notification.persona']" position="after">
8
5
  <span
9
- class="o_MessageNotificationPopoverContent_notificationPartnerName"
6
+ t-elif="notification.notification_type == 'gateway'"
10
7
  t-esc="notification.channel_name"
11
- t-if="notification.notification_type == 'gateway'"
12
8
  />
13
9
  </xpath>
14
10
  </t>
@@ -0,0 +1,23 @@
1
+ /* @odoo-module */
2
+ import {Composer} from "@mail/core/common/composer_model";
3
+ import {patch} from "@web/core/utils/patch";
4
+ import {url} from "@web/core/utils/urls";
5
+
6
+ patch(Composer, {
7
+ get resUrl() {
8
+ if (!this.gateway_thread_data) {
9
+ return super.resUrl;
10
+ }
11
+ return `${url("/web")}#model=${this.gateway_thread_data.model}&id=${
12
+ this.gateway_thread_data.id
13
+ }`;
14
+ },
15
+ });
16
+
17
+ patch(Composer.prototype, {
18
+ setup() {
19
+ super.setup();
20
+ this.gateway_channel = false;
21
+ this.gateway_partner = false;
22
+ },
23
+ });
@@ -0,0 +1,31 @@
1
+ /* @odoo-module */
2
+
3
+ import {DiscussApp} from "@mail/core/common/discuss_app_model";
4
+ import {Record} from "@mail/core/common/record";
5
+
6
+ import {_t} from "@web/core/l10n/translation";
7
+ import {patch} from "@web/core/utils/patch";
8
+
9
+ patch(DiscussApp, {
10
+ new(data) {
11
+ const res = super.new(data);
12
+ res.gateway = {
13
+ extraClass: "o-mail-DiscussSidebarCategory-gateway",
14
+ id: "gateway",
15
+ name: _t("Gateway"),
16
+ isOpen: false,
17
+ canView: false,
18
+ canAdd: true,
19
+ addTitle: _t("Search Gateway Channel"),
20
+ serverStateKey: "is_discuss_sidebar_category_gateway_open",
21
+ };
22
+ return res;
23
+ },
24
+ });
25
+
26
+ patch(DiscussApp.prototype, {
27
+ setup(env) {
28
+ super.setup(env);
29
+ this.gateway = Record.one("DiscussAppCategory");
30
+ },
31
+ });
@@ -0,0 +1,23 @@
1
+ /* @odoo-module */
2
+ import {_t} from "@web/core/l10n/translation";
3
+ import {messageActionsRegistry} from "@mail/core/common/message_actions";
4
+
5
+ messageActionsRegistry.add("link_gateway_to_thread", {
6
+ condition: (component) =>
7
+ component.message.gateway_type &&
8
+ component.props.thread.model === "discuss.channel",
9
+ icon: "fa-link",
10
+ title: _t("Link to thread"),
11
+ onClick: (component) => component.onClickLinkGatewayToThread(),
12
+ sequence: 20,
13
+ });
14
+
15
+ messageActionsRegistry.add("send_with_gateway", {
16
+ condition: (component) =>
17
+ !component.message.gateway_type &&
18
+ component.props.thread.model !== "discuss.channel",
19
+ icon: "fa-share-square-o",
20
+ title: _t("Send with gateway"),
21
+ onClick: (component) => component.onClickSendWithGateway(),
22
+ sequence: 20,
23
+ });
@@ -0,0 +1,21 @@
1
+ /* @odoo-module */
2
+ import {Message} from "@mail/core/common/message_model";
3
+ import {patch} from "@web/core/utils/patch";
4
+ import {url} from "@web/core/utils/urls";
5
+
6
+ patch(Message, {
7
+ get resUrl() {
8
+ if (!this.gateway_thread_data) {
9
+ return super.resUrl;
10
+ }
11
+ return `${url("/web")}#model=${this.gateway_thread_data.model}&id=${
12
+ this.gateway_thread_data.id
13
+ }`;
14
+ },
15
+ });
16
+
17
+ patch(Message.prototype, {
18
+ get editable() {
19
+ return super.editable && !this.gateway_type;
20
+ },
21
+ });
@@ -0,0 +1,35 @@
1
+ /* @odoo-module */
2
+ import {Notification} from "@mail/core/common/notification_model";
3
+ import {patch} from "@web/core/utils/patch";
4
+
5
+ patch(Notification.prototype, {
6
+ get icon() {
7
+ if (this.gateway_type) {
8
+ return `fa fa-${this.gateway_type}`;
9
+ }
10
+ return super.icon;
11
+ },
12
+ get statusIcon() {
13
+ if (!this.gateway_type) {
14
+ return super.statusIcon;
15
+ }
16
+ // It can be overriden on the gateway implementation
17
+ switch (this.notification_status) {
18
+ case "process":
19
+ return "fa fa-hourglass-half";
20
+ case "pending":
21
+ return "fa fa-paper-plane-o";
22
+ case "sent":
23
+ return `fa fa-${this.gateway_type} text-success`;
24
+ case "bounce":
25
+ return `fa fa-${this.gateway_type} text-danger`;
26
+ case "exception":
27
+ return `fa fa-${this.gateway_type} text-danger`;
28
+ case "ready":
29
+ return "fa fa-send-o";
30
+ case "canceled":
31
+ return "fa fa-trash-o";
32
+ }
33
+ return "";
34
+ },
35
+ });
@@ -0,0 +1,12 @@
1
+ /** @odoo-module */
2
+
3
+ import {Persona} from "@mail/core/common/persona_model";
4
+ import {patch} from "@web/core/utils/patch";
5
+ import {Record} from "@mail/core/common/record";
6
+
7
+ patch(Persona.prototype, {
8
+ setup() {
9
+ super.setup();
10
+ this.gateway_channels = Record.many("GatewayChannel");
11
+ },
12
+ });
@@ -0,0 +1,14 @@
1
+ /* @odoo-module */
2
+ import {Gateway} from "../../models/gateway.esm";
3
+ import {Store} from "@mail/core/common/store_service";
4
+ import {patch} from "@web/core/utils/patch";
5
+
6
+ /** @type {import("models").Store} */
7
+ const storePatch = {
8
+ setup() {
9
+ super.setup(...arguments);
10
+ /** @type {typeof import("@mail_gateway/models/gateway").Gateway} */
11
+ this.Gateway = Gateway;
12
+ },
13
+ };
14
+ patch(Store.prototype, storePatch);
@@ -0,0 +1,49 @@
1
+ /* @odoo-module */
2
+ import {assignDefined, assignIn} from "@mail/utils/common/misc";
3
+ import {patch} from "@web/core/utils/patch";
4
+ import {Record} from "@mail/core/common/record";
5
+ import {Thread} from "@mail/core/common/thread_model";
6
+ import {url} from "@web/core/utils/urls";
7
+
8
+ patch(Thread, {
9
+ _insert(data) {
10
+ const thread = super._insert(...arguments);
11
+ if (thread.type === "gateway") {
12
+ assignIn(thread, data, ["anonymous_name", "gateway"]);
13
+ this.store.discuss.gateway.threads.add(thread);
14
+ }
15
+ return thread;
16
+ },
17
+ });
18
+
19
+ patch(Thread.prototype, {
20
+ setup() {
21
+ super.setup();
22
+ this.gateway = Record.one("Gateway");
23
+ this.operator = Record.one("Persona");
24
+ this.gateway_notifications = [];
25
+ this.gateway_followers = Record.many("Persona");
26
+ },
27
+ get isChatChannel() {
28
+ return this.type === "gateway" || super.isChatChannel;
29
+ },
30
+ get hasMemberList() {
31
+ return this.type === "gateway" || super.hasMemberList;
32
+ },
33
+ get imgUrl() {
34
+ if (this.type !== "gateway") {
35
+ return super.imgUrl;
36
+ }
37
+ return url(
38
+ `/discuss/channel/${this.id}/avatar_128`,
39
+ assignDefined({}, {unique: this.avatarCacheKey})
40
+ );
41
+ },
42
+ /** @param {Object} data */
43
+ update(data) {
44
+ super.update(data);
45
+ if ("gateway_id" in data && this.type === "gateway") {
46
+ this.gateway = data.gateway_id;
47
+ }
48
+ },
49
+ });
@@ -0,0 +1,19 @@
1
+ /* @odoo-module */
2
+ import {ThreadService} from "@mail/core/common/thread_service";
3
+ import {patch} from "@web/core/utils/patch";
4
+
5
+ patch(ThreadService.prototype, {
6
+ async fetchData(thread, ...args) {
7
+ const result = await super.fetchData(thread, ...args);
8
+ thread.gateway_followers = result.gateway_followers;
9
+ return result;
10
+ },
11
+ async getMessagePostParams(params) {
12
+ const post_params = await super.getMessagePostParams(...arguments);
13
+ if (params.thread.gateway_notifications) {
14
+ post_params.post_data.gateway_notifications =
15
+ params.thread.gateway_notifications;
16
+ }
17
+ return post_params;
18
+ },
19
+ });
@@ -0,0 +1,21 @@
1
+ /* @odoo-module */
2
+
3
+ import {patch} from "@web/core/utils/patch";
4
+ import {DiscussAppCategory} from "@mail/core/common/discuss_app_category_model";
5
+ import {compareDatetime} from "@mail/utils/common/misc";
6
+
7
+ patch(DiscussAppCategory.prototype, {
8
+ /**
9
+ * @param {import("models").Thread} t1
10
+ * @param {import("models").Thread} t2
11
+ */
12
+ sortThreads(t1, t2) {
13
+ if (this.id === "gateway") {
14
+ return (
15
+ compareDatetime(t2.lastInterestDateTime, t1.lastInterestDateTime) ||
16
+ t2.id - t1.id
17
+ );
18
+ }
19
+ return super.sortThreads(t1, t2);
20
+ },
21
+ });
@@ -0,0 +1,16 @@
1
+ /* @odoo-module */
2
+
3
+ import {discussSidebarCategoriesRegistry} from "@mail/discuss/core/web/discuss_sidebar_categories";
4
+
5
+ discussSidebarCategoriesRegistry.add(
6
+ "gateway",
7
+ {
8
+ predicate: (store) => {
9
+ store.discuss.gateway.threads.some(
10
+ (thread) => thread?.displayToSelf || thread?.isLocallyPinned
11
+ );
12
+ },
13
+ value: (store) => store.discuss.gateway,
14
+ },
15
+ {sequence: 30}
16
+ );
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <templates>
3
+ <t
4
+ t-name="mail_gateway.DiscussSidebarChannel"
5
+ t-inherit="mail.DiscussSidebarChannel"
6
+ t-inherit-mode="extension"
7
+ >
8
+ <xpath expr="//ThreadIcon" position="attributes">
9
+ <attribute name="t-if" add="or thread.type === 'gateway'" separator=" " />
10
+ </xpath>
11
+ </t>
12
+ </templates>
@@ -0,0 +1,40 @@
1
+ /* @odoo-module */
2
+ import {reactive} from "@odoo/owl";
3
+ import {registry} from "@web/core/registry";
4
+
5
+ export class GatewayCoreWeb {
6
+ constructor(env, services) {
7
+ Object.assign(this, {
8
+ busService: services.bus_service,
9
+ });
10
+ /** @type {import("@mail/core/common/messaging_service").Messaging} */
11
+ this.messagingService = services["mail.messaging"];
12
+ /** @type {import("@mail/core/common/store_service").Store} */
13
+ this.store = services["mail.store"];
14
+ }
15
+ setup() {
16
+ this.messagingService.isReady.then((data) => {
17
+ if (data.current_user_settings?.is_discuss_sidebar_category_gateway_open) {
18
+ this.store.discuss.gateway.isOpen = true;
19
+ }
20
+ this.busService.subscribe("res.users.settings", (payload) => {
21
+ if (payload) {
22
+ this.store.discuss.gateway.isOpen =
23
+ payload.is_discuss_sidebar_category_gateway_open ??
24
+ this.store.discuss.gateway.isOpen;
25
+ }
26
+ });
27
+ });
28
+ }
29
+ }
30
+
31
+ export const gatewayCoreWeb = {
32
+ dependencies: ["bus_service", "mail.messaging", "mail.store"],
33
+ start(env, services) {
34
+ const gatewayCoreWeb = reactive(new GatewayCoreWeb(env, services));
35
+ gatewayCoreWeb.setup();
36
+ return gatewayCoreWeb;
37
+ },
38
+ };
39
+
40
+ registry.category("services").add("mail_gateway.core.web", gatewayCoreWeb);
@@ -1,16 +1,23 @@
1
1
  /** @odoo-module **/
2
+ import {Record} from "@mail/core/common/record";
2
3
 
3
- import {attr, many} from "@mail/model/model_field";
4
- import {registerModel} from "@mail/model/model_core";
5
-
6
- registerModel({
7
- name: "Gateway",
8
- fields: {
9
- id: attr({identifying: true}),
10
- name: attr(),
11
- type: attr(),
12
- categories: many("DiscussSidebarCategory", {
13
- inverse: "gateway",
14
- }),
15
- },
16
- });
4
+ export class Gateway extends Record {
5
+ static id = "id";
6
+ /** @type {Object.<number, import("models").Gateway>} */
7
+ static records = {};
8
+ /** @returns {import("models").Gateway} */
9
+ static get(data) {
10
+ return super.get(data);
11
+ }
12
+ /** @returns {import("models").Gateway|import("models").Gateway[]} */
13
+ static insert() {
14
+ return super.insert(...arguments);
15
+ }
16
+ /** @type {number} */
17
+ id;
18
+ /** @type {string} */
19
+ type;
20
+ /** @type {string} */
21
+ name;
22
+ }
23
+ Gateway.register();
@@ -1,14 +1,22 @@
1
- /** @odoo-module **/
1
+ /* @odoo-module */
2
+ import {Record} from "@mail/core/common/record";
2
3
 
3
- import {attr, one} from "@mail/model/model_field";
4
- import {registerModel} from "@mail/model/model_core";
5
-
6
- registerModel({
7
- name: "GatewayChannel",
8
- fields: {
9
- id: attr({identifying: true}),
10
- name: attr(),
11
- gateway: one("Gateway"),
12
- partner: one("Partner", {inverse: "gateway_channels"}),
13
- },
14
- });
4
+ export class GatewayChannel extends Record {
5
+ static id = "id";
6
+ /** @type {Object.<number, import("models").GatewayChannel>} */
7
+ static records = {};
8
+ /** @returns {import("models").GatewayChannel} */
9
+ static get(data) {
10
+ return super.get(data);
11
+ }
12
+ /** @returns {import("models").GatewayChannel|import("models").GatewayChannel[]} */
13
+ static insert() {
14
+ return super.insert(...arguments);
15
+ }
16
+ /** @type {number} */
17
+ id;
18
+ /** @type {string} */
19
+ name;
20
+ gateway = Record.one("Gateway");
21
+ }
22
+ GatewayChannel.register();
@@ -0,0 +1,24 @@
1
+ /** @odoo-module **/
2
+ import {Record} from "@mail/core/common/record";
3
+
4
+ export class GatewayFollower extends Record {
5
+ static id = "id";
6
+ /** @type {Object.<number, import("models").GatewayFollower>} */
7
+ static records = {};
8
+ /** @returns {import("models").GatewayFollower} */
9
+ static get(data) {
10
+ return super.get(data);
11
+ }
12
+ /** @returns {import("models").GatewayFollower|import("models").GatewayFollower[]} */
13
+ static insert() {
14
+ return super.insert(...arguments);
15
+ }
16
+ /** @type {number} */
17
+ id;
18
+ /** @type {string} */
19
+ name;
20
+ partner = Record.one("Persona");
21
+ channel = Record.one("GatewayChannel");
22
+ }
23
+
24
+ GatewayFollower.register();
@@ -15,21 +15,21 @@
15
15
  string="Integrate Webhook"
16
16
  icon="fa-plug"
17
17
  name="set_webhook"
18
- attrs="{'invisible': ['|', ('can_set_webhook', '=', False), ('integrated_webhook_state', '!=', False)]}"
18
+ invisible="not can_set_webhook or integrated_webhook_state"
19
19
  />
20
20
  <button
21
21
  type="object"
22
22
  string="Update Webhook"
23
23
  name="update_webhook"
24
24
  icon="fa-refresh"
25
- attrs="{'invisible': ['|', ('can_set_webhook', '=', False), ('integrated_webhook_state', '!=', 'integrated')]}"
25
+ invisible="not can_set_webhook or integrated_webhook_state != 'integrated'"
26
26
  />
27
27
  <button
28
28
  type="object"
29
29
  string="Remove Webhook"
30
30
  name="remove_webhook"
31
31
  icon="fa-remove"
32
- attrs="{'invisible': [('integrated_webhook_state', '=', False)]}"
32
+ invisible="not integrated_webhook_state"
33
33
  />
34
34
  </div>
35
35
  <field name="can_set_webhook" invisible="1" />
@@ -73,7 +73,7 @@
73
73
  <field name="arch" type="xml">
74
74
  <tree>
75
75
  <field name="name" />
76
- <field name="token" />
76
+ <field name="token" password="True" />
77
77
  </tree>
78
78
  </field>
79
79
  </record>
@@ -0,0 +1,15 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <odoo>
3
+ <record id="mail_guest_view_form" model="ir.ui.view">
4
+ <field name="inherit_id" ref="mail.mail_guest_view_form" />
5
+ <field name="model">mail.guest</field>
6
+ <field name="arch" type="xml">
7
+ <group position="inside">
8
+ <group name="gateway_info" invisible="not gateway_id">
9
+ <field name="gateway_id" />
10
+ <field name="gateway_token" password="1" readonly="1" />
11
+ </group>
12
+ </group>
13
+ </field>
14
+ </record>
15
+ </odoo>