From ca479c4595a46d3873db55bb4a1bc47c701f3337 Mon Sep 17 00:00:00 2001
From: OCA-git-bot
Date: Mon, 30 May 2022 10:54:37 +0000
Subject: [PATCH] [UPD] README.rst
---
base_comment_template/README.rst | 27 +++++++++++-----
.../static/description/index.html | 31 ++++++++++++++-----
2 files changed, 43 insertions(+), 15 deletions(-)
diff --git a/base_comment_template/README.rst b/base_comment_template/README.rst
index 50a03023a..dfc2eedc1 100644
--- a/base_comment_template/README.rst
+++ b/base_comment_template/README.rst
@@ -87,20 +87,33 @@ The template is a html field which will be rendered just like a mail template, s
Change the report related to the model from configuration and add a statement like:
-
+
+
-
+
-
-
+
+
-
-
-
+
You should always use t-if since the method returns False if no template is found.
+If you want to use Qweb templates, or different context, you can specify it just like in
+mail.render.mixin with parameters:
+
+- engine: "jinja" or "qweb",
+- add_context: dict with your own context,
+- post_process: perform a post processing on rendered result
+
+so you could use it :
+
+
+
+
+
+
Bug Tracker
===========
diff --git a/base_comment_template/static/description/index.html b/base_comment_template/static/description/index.html
index 9bb4d0780..cd4bfc9b4 100644
--- a/base_comment_template/static/description/index.html
+++ b/base_comment_template/static/description/index.html
@@ -433,15 +433,30 @@ It has a priority field (smaller number = higher priority)
If you create a new template with the same configuration (Model, Domain, Position) and set it as Default, the previous one will be deselected as a default one.
The template is a html field which will be rendered just like a mail template, so you can use variables like ${object}, ${user}, ${ctx} to add dynamic content.
Change the report related to the model from configuration and add a statement like:
-<p t-if=”o.get_comment_template(‘before_lines’, o.company_id.id, o.partner_id and o.partner_id.id or False)”>
-
-<span t-raw=”o.get_comment_template(‘before_lines’, o.company_id.id, o.partner_id and o.partner_id.id or False)”/>
-</p>
-<p t-if=”o.get_comment_template(‘after_lines’, o.company_id.id, o.partner_id and o.partner_id.id or False)”>
-
-<span t-raw=”o.get_comment_template(‘after_lines’, o.company_id.id, o.partner_id and o.partner_id.id or False)”/>
-</p>
+
+- <t t-foreach=”o.comment_template_ids.filtered(lambda x: x.position == ‘before_lines’)” t-as=”comment_template_top”>
+- <div t-raw=”o.render_comment(comment_template_top)” />
+
+</t>
+
+- <t t-foreach=”o.comment_template_ids.filtered(lambda x: x.position == ‘after_lines’)” t-as=”comment_template_bottom”>
+- <div t-raw=”o.render_comment(comment_template_bottom)” />
+
+</t>
You should always use t-if since the method returns False if no template is found.
+If you want to use Qweb templates, or different context, you can specify it just like in
+mail.render.mixin with parameters:
+
+- engine: “jinja” or “qweb”,
+- add_context: dict with your own context,
+- post_process: perform a post processing on rendered result
+
+so you could use it :
+
+- <t t-foreach=”o.comment_template_ids.filtered(lambda x: x.position == ‘before_lines’)” t-as=”comment_template_top”>
+- <div t-raw=”o.render_comment(comment_template_top, engine=’qweb’, add_context={my dict}, postprocess=True)” />
+
+</t>