-
-
Notifications
You must be signed in to change notification settings - Fork 623
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] email_template_qweb: Migration to 17.0
- Loading branch information
1 parent
28acbb2
commit 4c4c80b
Showing
8 changed files
with
78 additions
and
72 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,11 +45,13 @@ Usage | |
|
||
To use this module, you need to: | ||
|
||
1. Select QWeb View in the field Body templating engine | ||
2. Select a QWeb View to be used to render the body field | ||
3. Apart from QWeb View standard variables, you also have access to | ||
``object`` and ``email_template``, which are browse records of the | ||
current object and the email template in use, respectively. | ||
1. Go to *Settings / Email Templates* and create a new template | ||
2. Select QWeb View in the field Body templating engine | ||
3. Select a QWeb View to be used to render the body field | ||
|
||
Apart from QWeb View standard variables, you also have access to | ||
``object`` and ``email_template``, which are browse records of the | ||
current object and the email template in use, respectively. | ||
|
||
Bug Tracker | ||
=========== | ||
|
@@ -92,6 +94,8 @@ Contributors | |
|
||
- Dzung Tran <[email protected]> | ||
|
||
- Anaïs Lopez <[email protected]> | ||
|
||
Other credits | ||
------------- | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,5 +14,7 @@ | |
|
||
- Foram Shah \<<[email protected]>\> | ||
|
||
- [Trobz](https://trobz.com): | ||
- [Trobz](https://trobz.com): | ||
- Dzung Tran \<<[email protected]>\> | ||
|
||
- Anaïs Lopez \<<[email protected]>\> |
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,7 +1,9 @@ | ||
To use this module, you need to: | ||
|
||
1. Select QWeb View in the field Body templating engine | ||
2. Select a QWeb View to be used to render the body field | ||
3. Apart from QWeb View standard variables, you also have access to | ||
`object` and `email_template`, which are browse records of the | ||
current object and the email template in use, respectively. | ||
1. Go to *Settings / Email Templates* and create a new template | ||
2. Select QWeb View in the field Body templating engine | ||
3. Select a QWeb View to be used to render the body field | ||
|
||
Apart from QWeb View standard variables, you also have access to | ||
`object` and `email_template`, which are browse records of the | ||
current object and the email template in use, respectively. |
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 |
---|---|---|
@@ -1,23 +1,27 @@ | ||
# Copyright 2016 Therp BV <http://therp.nl> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
# Copyright 2016-2024 Therp BV <http://therp.nl> | ||
# Copyright 2024 ForgeFlow S.L. (https://www.forgeflow.com) | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
from odoo.tests.common import TransactionCase | ||
|
||
|
||
class TestMailTemplateQweb(TransactionCase): | ||
def test_email_template_qweb(self): | ||
template = self.env.ref("email_template_qweb.email_template_demo1") | ||
mail_values = template.generate_email([self.env.user.id], ["body_html"]) | ||
render_fields = ["body_html"] | ||
mail_values = template._generate_template([self.env.user.id], render_fields) | ||
self.assertTrue( | ||
# this comes from the called template if everything worked | ||
"<footer>" in mail_values[self.env.user.id]["body_html"], | ||
"Did not receive rendered template in response. Got: \n%s\n" | ||
% (mail_values[self.env.user.id]["body_html"]), | ||
"Did not receive rendered template in response. Got: \n{}".format( | ||
mail_values[self.env.user.id]["body_html"] | ||
), | ||
) | ||
# the same method is also called in a non multi mode | ||
mail_values = template.generate_email(self.env.user.id, ["body_html"]) | ||
mail_values_single_mode = template._generate_template( | ||
[self.env.user.id], render_fields | ||
) | ||
self.assertTrue( | ||
# this comes from the called template if everything worked | ||
"<footer>" in mail_values["body_html"], | ||
"Did not receive rendered template in response. Got: \n%s\n" | ||
% (mail_values["body_html"]), | ||
"<footer>" in mail_values_single_mode[self.env.user.id]["body_html"], | ||
"Did not receive rendered template in response. Got: \n{}".format( | ||
mail_values_single_mode[self.env.user.id]["body_html"] | ||
), | ||
) |
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