Merge PR #788 into 16.0

Signed-off-by pedrobaeza
This commit is contained in:
OCA-git-bot
2023-09-03 18:43:33 +00:00
3 changed files with 13 additions and 2 deletions

View File

@@ -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 (

View File

@@ -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,
)

View File

@@ -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>