-
-
Notifications
You must be signed in to change notification settings - Fork 633
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] mail_forward: Migration to version 17.0
- Loading branch information
1 parent
807ef4a
commit edfbe03
Showing
12 changed files
with
126 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 25 additions & 23 deletions
48
mail_forward/static/src/components/forward_message/forward_message.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,34 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<templates xml:space="preserve"> | ||
<t t-name="mail_forward.ForwardMessage" owl="1"> | ||
<span | ||
class="o_MessageActionList_action o_MessageActionList_actionForward fa-stack" | ||
<t t-name="mail_forward.ForwardMessage"> | ||
<div | ||
class="mail_forward_message w-100" | ||
title="Forward Message" | ||
role="button" | ||
tabindex="0" | ||
aria-label="Forward Message" | ||
t-on-click="onClickForwardMessage" | ||
> | ||
<i | ||
class="fa fa-lg fa-share fa-stack-1x" | ||
style="margin-left:1px" | ||
role="img" | ||
aria-label="Forward Message Left" | ||
/> | ||
<i | ||
class="fa fa-lg fa-share fa-inverse fa-stack-1x" | ||
style="margin-left:-2px;" | ||
role="img" | ||
aria-label="Forward Message Center" | ||
/> | ||
<i | ||
class="fa fa-lg fa-share fa-stack-1x" | ||
style="margin-left:-3px" | ||
role="img" | ||
aria-label="Forward Message Right" | ||
/> | ||
</span> | ||
<span class="fa-stack" style="width: 1.5em"> | ||
<i | ||
class="fa fa-lg fa-share fa-stack-1x" | ||
style="margin-left:1px" | ||
role="img" | ||
aria-label="Forward Message Left" | ||
/> | ||
<i | ||
class="fa fa-lg fa-share fa-inverse fa-stack-1x" | ||
style="margin-left:-2px;" | ||
role="img" | ||
aria-label="Forward Message Center" | ||
/> | ||
<i | ||
class="fa fa-lg fa-share fa-stack-1x" | ||
style="margin-left:-3px" | ||
role="img" | ||
aria-label="Forward Message Right" | ||
/> | ||
</span> | ||
Forward | ||
</div> | ||
</t> | ||
</templates> |
12 changes: 0 additions & 12 deletions
12
mail_forward/static/src/components/message_action_list/message_action_list.xml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<templates xml:space="preserve"> | ||
<t t-inherit="mail.Message.actions" t-inherit-mode="extension"> | ||
<!-- | ||
In the DropdownItem, render the callComponent if it is defined, | ||
similar to how it is rendered for quick actions. | ||
Currently, Odoo only renders the callComponent for quick actions (2 or 3 actions). | ||
However, the remaining actions, rendered as DropdownItem, do not invoke the callComponent. | ||
See the related code here: | ||
https://github.com/odoo/odoo/blob/a32626be4cfbaeb21ed64a0abaad298e8e223ea3/addons/mail/static/src/core/common/message.xml#L146-L160 --> | ||
<xpath expr="//DropdownItem//i" position="before"> | ||
<t | ||
t-if="action.callComponent" | ||
t-component="action.callComponent" | ||
t-props="action.props" | ||
/> | ||
<t t-else=""> | ||
<!-- used to move the elements into the t-else --> | ||
<span class="mail_action_item d-none" /> | ||
</t> | ||
</xpath> | ||
<xpath expr="//span[hasclass('mail_action_item')]" position="before"> | ||
<xpath expr="//DropdownItem/i" position="move" /> | ||
<xpath expr="//DropdownItem/t[@t-esc='action.title']" position="move" /> | ||
</xpath> | ||
</t> | ||
</templates> |
17 changes: 17 additions & 0 deletions
17
mail_forward/static/src/core/common/message_actions.esm.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* @odoo-module */ | ||
/* Copyright 2024 Tecnativa - Carlos Lopez | ||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). | ||
*/ | ||
|
||
import {_t} from "@web/core/l10n/translation"; | ||
import {ForwardMessage} from "../../components/forward_message/forward_message.esm"; | ||
import {messageActionsRegistry} from "@mail/core/common/message_actions"; | ||
|
||
messageActionsRegistry.add("forward", { | ||
callComponent: ForwardMessage, | ||
props: (component) => ({message: component.props.message}), | ||
condition: (component) => | ||
component.props.message.is_discussion && !component.props.message.is_note, | ||
sequence: 15, | ||
title: _t("Forward"), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ class TestMailForward(TestMailComposer, HttpCase): | |
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass() | ||
cls.test_record.write({"name": "Test Forward", "email": "[email protected]"}) | ||
cls.partner_follower1 = cls.env["res.partner"].create( | ||
{"name": "Follower1", "email": "[email protected]"} | ||
) | ||
|
@@ -29,7 +30,7 @@ def test_01_mail_forward(self): | |
""" | ||
ctx = { | ||
"default_model": self.test_record._name, | ||
"default_res_id": self.test_record.id, | ||
"default_res_ids": [self.test_record.id], | ||
} | ||
composer_form = Form(self.env["mail.compose.message"].with_context(**ctx)) | ||
composer_form.body = "<p>Hello</p>" | ||
|
@@ -69,9 +70,15 @@ def test_01_mail_forward(self): | |
self.assertIn("---------- Forwarded message ---------", forward_message.body) | ||
|
||
def test_02_mail_forward_tour(self): | ||
self.test_record.message_post( | ||
body="Hello World", message_type="comment", subtype_xmlid="mail.mt_comment" | ||
) | ||
self.start_tour("/web", "mail_forward.mail_forward_tour", login="admin") | ||
|
||
def test_03_mail_note_not_forward_tour(self): | ||
self.test_record.message_post( | ||
body="This is a note", message_type="comment", subtype_xmlid="mail.mt_note" | ||
) | ||
self.start_tour( | ||
"/web", "mail_forward.mail_note_not_forward_tour", login="admin" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters