Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ options:

- https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.18/test_repo/odoo18_module/views/deprecated_qweb_directives15.xml#L6 Deprecated QWeb directive `t-esc`. Use `t-out` instead
- https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.18/test_repo/odoo18_module/views/deprecated_qweb_directives15.xml#L7 Deprecated QWeb directive `t-raw`. Use `t-out` instead
- https://github.com/OCA/odoo-pre-commit-hooks/blob/v0.2.18/test_repo/odoo18_module/views/deprecated_qweb_directives15.xml#L13 Deprecated QWeb directive `t-esc`. Use `t-out` instead

* xml-deprecated-tree-attribute

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,11 @@
<span t-raw="amount" />
</div>
</template>
<template id="test_template_15_2" name="test_template_15_2">
<div class="mt32">
<div class="text-left">
<strong>Name <t t-esc="o.name" /></strong>
</div>
</div>
</template>
</odoo>
11 changes: 10 additions & 1 deletion tests/test_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"xml-dangerous-qweb-replace-low-priority": 9,
"xml-deprecated-data-node": 8,
"xml-deprecated-openerp-node": 4,
"xml-deprecated-qweb-directive-15": 2,
"xml-deprecated-qweb-directive-15": 3,
"xml-deprecated-qweb-directive": 2,
"xml-deprecated-tree-attribute": 3,
"xml-double-quotes-py": 3,
Expand Down Expand Up @@ -254,6 +254,11 @@ def test_autofix(self):
with open(escaped_double_quotes, "rb") as f:
content = f.read()
assert b"&quot;" in content, "The escaped double quotes was previously fixed"
t_out = os.path.join(self.test_repo_path, "odoo18_module", "views", "deprecated_qweb_directives15.xml")

with open(t_out, "rb") as f:
content = f.read()
assert b"t-out" not in content, "The deprecated t-out was previously fixed"

self.checks_run(self.file_paths, autofix=True, no_exit=True, no_verbose=False)

Expand Down Expand Up @@ -335,3 +340,7 @@ def test_autofix(self):
with open(escaped_double_quotes, "rb") as f:
content = f.read()
assert b"&quot;" not in content, "The escaped double quotes was not fixed"

with open(t_out, "rb") as f:
content = f.read()
assert b"t-out" in content, "The deprecated t-out was not fixed"
Loading