-
-
Notifications
You must be signed in to change notification settings - Fork 615
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MIG] email_template_qweb: Migration to 15.0 #1072
Merged
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
ac433de
[ADD] email_template_qweb
lasley b91a17e
[FIX] Call to generate_email can be done with a list of ids or only o…
lmignon 00aa465
[MIG] email_template_qweb: Migrated to 10.0
bouvyd daee701
[FIX] email_template_qweb: Decode body when encoded
pedrobaeza 5ae4968
OCA Transbot updated translations from Transifex
oca-transbot 5b7b097
[11][MIG] email_template_qweb: Migration to 11.0
celm1990 f9f725c
[UPD] Update email_template_qweb.pot
oca-travis ec3b55a
[MIG] email_template_qweb: Migration to 12.0
ernestotejeda 48a4c37
[UPD] README.rst
OCA-git-bot 5ae8ed0
[UPD] Update email_template_qweb.pot
oca-travis 6e5a314
Update translation files
oca-transbot 5701595
[UPD] README.rst
OCA-git-bot 6ab0d55
Translated using Weblate (Portuguese (Brazil))
17ba39b
Translated using Weblate (Portuguese (Brazil))
5382bde
[IMP] email_template_qweb: black, isort
tfossoul d2697b5
[MIG] email_template_qweb: Migration to 13.0
tfossoul 8830fc3
[UPD] Update email_template_qweb.pot
oca-travis 6e0ee0b
[UPD] README.rst
OCA-git-bot 703a9e0
Update translation files
oca-transbot 2feb0bf
Update translation files
oca-transbot 5b2ef9a
[IMP] pre-commit run -a
acb36f7
[MIG] email_template_qweb: Migration to 14.0
phuctranfxvn 43dec7b
[UPD] Update email_template_qweb.pot
oca-travis ec72cef
[UPD] README.rst
OCA-git-bot 95d06b5
Translated using Weblate (French)
Yvesldff 0030f88
Added translation using Weblate (French (France))
Yvesldff d5655dc
Translated using Weblate (French (France))
Yvesldff 00e58b8
[FIX] email_template_qweb: get translations working
sebalix 23454b0
email_template_qweb 14.0.1.0.1
OCA-git-bot 1bd1fc2
[IMP] update dotfiles [ci skip]
OCA-git-bot 71d6107
[IMP] email_template_qweb: black, isort, prettier
dzungtran89 71fdbcb
[MIG] email_template_qweb: Migration to 15.0
fshah-initos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
29 changes: 29 additions & 0 deletions
29
email_template_qweb/migrations/15.0.1.0.0/pre-migration.py
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,29 @@ | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import SUPERUSER_ID, api | ||
|
||
|
||
def migrate(cr, version): | ||
if not version: | ||
return | ||
|
||
env = api.Environment(cr, SUPERUSER_ID, {}) | ||
body_type = env["ir.model.fields"].search( | ||
[("name", "=", "body_type"), ("model", "=", "mail.template")] | ||
) | ||
|
||
# Note: no need to migrate the existing values of the `body_type` of the | ||
# model `mail_template` because Odoo already does it | ||
# See https://github.com/odoo/odoo/blob/15.0/odoo/addons/base/models/ir_model.py#L1351 | ||
if body_type: | ||
# qweb -> qweb_view | ||
qweb = env["ir.model.fields.selection"].search( | ||
[("value", "=", "qweb"), ("field_id", "=", body_type.id)] | ||
) | ||
qweb.write({"value": "qweb_view"}) | ||
|
||
# jinja2 -> qweb | ||
jinja = env["ir.model.fields.selection"].search( | ||
[("value", "=", "jinja2"), ("field_id", "=", body_type.id)] | ||
) | ||
jinja.write({"value": "qweb"}) |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
This module was written to allow you to write email templates in QWeb instead | ||
of jinja2. The advantage here is that with QWeb, you can make use of | ||
This module was written to allow you to write email templates in `QWeb view` instead | ||
of QWeb. The advantage here is that with QWeb View, you can make use of | ||
inheritance and the ``call`` statement, which allows you to reuse designs and | ||
snippets in multiple templates, making your development process simpler. | ||
Furthermore, QWeb views are easier to edit with the integrated ACE editor. |
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,5 +1,5 @@ | ||
To use this module, you need to: | ||
|
||
#. Select `QWeb` in the field `Body templating engine` | ||
#. Select a QWeb view to be used to render the body field | ||
#. Apart from QWeb's 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. | ||
#. Select `QWeb View` in the field `Body templating engine` | ||
#. 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't you by now override https://github.com/odoo/odoo/blob/15.0/addons/mail/models/mail_render_mixin.py#L565 and just pass the value of
body_type
inengine
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That actually renders a mail template, while this tries to take the predefined views to render the mail's body
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know what the module is doing because I'm it's original author ;-)
But now I see this function insists on views with an xmlid for that case, so it's indeed not usable for our case