Skip to content

Commit

Permalink
Merge PR #788 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Sep 3, 2023
2 parents 5019f30 + c6e3030 commit 88a1b4f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
10 changes: 10 additions & 0 deletions base_comment_template/models/base_comment_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
4 changes: 2 additions & 2 deletions base_comment_template/models/comment_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ def _compute_comment_template_ids(self):
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,
)
Expand Down
1 change: 1 addition & 0 deletions base_comment_template/views/base_comment_template_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
<field name="domain" />
<field name="models" />
<field name="partner_ids" widget="many2many_tags" />
<field name="engine" groups="base.group_no_one" />
</group>
</group>
<notebook>
Expand Down

0 comments on commit 88a1b4f

Please sign in to comment.