diff --git a/base_comment_template/models/base_comment_template.py b/base_comment_template/models/base_comment_template.py
index 09f7f2fe0..37c0a5f54 100644
--- a/base_comment_template/models/base_comment_template.py
+++ b/base_comment_template/models/base_comment_template.py
@@ -72,6 +72,16 @@ class BaseCommentTemplate(models.Model):
sequence = fields.Integer(
required=True, default=10, help="The smaller number = The higher priority"
)
+ engine = fields.Selection(
+ selection=[
+ ("inline_template", "Inline Template"),
+ ("qweb", "QWeb"),
+ ("qweb_view", "QWeb View"),
+ ],
+ required=True,
+ default="inline_template",
+ help="This field allows to select the engine to use for rendering the template.",
+ )
def _get_ir_model_items(self, models):
return (
diff --git a/base_comment_template/models/comment_template.py b/base_comment_template/models/comment_template.py
index 64afe3980..63a34decd 100644
--- a/base_comment_template/models/comment_template.py
+++ b/base_comment_template/models/comment_template.py
@@ -50,14 +50,14 @@ class CommentTemplate(models.AbstractModel):
record.comment_template_ids = [(4, template.id)]
def render_comment(
- self, comment, engine="inline_template", add_context=None, post_process=False
+ self, comment, engine=False, add_context=None, post_process=False
):
self.ensure_one()
comment_texts = self.env["mail.render.mixin"]._render_template(
template_src=comment.text,
model=self._name,
res_ids=[self.id],
- engine=engine,
+ engine=engine or comment.engine,
add_context=add_context,
post_process=post_process,
)
diff --git a/base_comment_template/views/base_comment_template_view.xml b/base_comment_template/views/base_comment_template_view.xml
index 50964fe60..8fa523737 100644
--- a/base_comment_template/views/base_comment_template_view.xml
+++ b/base_comment_template/views/base_comment_template_view.xml
@@ -71,6 +71,7 @@
+