[FIX] digest: using greaterthan and lessthan builtins

Before this commit, when you send a digest template to the user,
the user would receive a blank mail(without any content).
And while rendering the template we were getting the following error:
jinja2.exceptions.TemplateSyntaxError: unexpected char '&' at 4039

This was due to the changes made in commit:
https://github.com/odoo/odoo/commit/a7ac71ed4404aa2630619c331d725f4f545626f8#diff-705145eec648d5ef61b7b4060ae96b9dR8
In this instead of using CDATA, there was a change of the field type to 'html' and thus there were issues of parsing for jinja.

Now after this commit, we will be using builtins of jinja:
 - 'greaterthan' instead of '>'
 - 'lessthan' instead of '<'

Task-1918364
This commit is contained in:
Parth Choksi
2019-05-07 07:04:34 +00:00
parent 52b4942525
commit 8776306e80
+6 -6
View File
@@ -56,10 +56,10 @@
<span style="color: #888888; display: inline-block; font-size: 12px; line-height: 18px; text-transform: uppercase;">Yesterday</span>
% if data['yesterday'][kpi]['margin'] != 0.0:
<span style="color: #888888; display: block; font-size: 12px; line-height: 18px; text-transform: uppercase;">
% if data['yesterday'][kpi]['margin'] &gt; 0.0:
% if data['yesterday'][kpi]['margin'] is greaterthan(0.0):
<span style="color: #0bbc22;">▲</span>${"%.2f" % data['yesterday'][kpi]['margin']} %
% endif
% if data['yesterday'][kpi]['margin'] &lt; 0.0:
% if data['yesterday'][kpi]['margin'] is lessthan(0.0):
<span style="color: #ff0000;">▼</span>${"%.2f" % data['yesterday'][kpi]['margin']} %
% endif
</span>
@@ -76,10 +76,10 @@
<span style="color: #888888; display: inline-block; font-size: 12px; line-height: 18px; text-transform: uppercase;">Last 7 Days</span>
% if data['lastweek'][kpi]['margin'] != 0.0:
<span style="color: #888888; display: block; font-size: 12px; line-height: 18px; text-transform: uppercase;">
% if data['lastweek'][kpi]['margin'] &gt; 0.0:
% if data['lastweek'][kpi]['margin'] is greaterthan(0.0):
<span style="color: #0bbc22;">▲</span>${"%.2f" % data['lastweek'][kpi]['margin']} %
% endif
% if data['lastweek'][kpi]['margin'] &lt;0.0:
% if data['lastweek'][kpi]['margin'] is lessthan(0.0):
<span style="color: #ff0000;">▼</span>${"%.2f" % data['lastweek'][kpi]['margin']} %
%endif
</span>
@@ -96,10 +96,10 @@
<span style="color: #888888; display: inline-block; font-size: 12px; line-height: 18px; text-transform: uppercase;">Last 30 Days</span>
% if data['lastmonth'][kpi]['margin'] != 0.0:
<span style="color: #888888; display: block; font-size: 12px; line-height: 18px; text-transform: uppercase;">
% if data['lastmonth'][kpi]['margin'] &gt; 0.0:
% if data['lastmonth'][kpi]['margin'] is greaterthan(0.0):
<span style="color: #0bbc22;">▲</span>${"%.2f" % data['lastmonth'][kpi]['margin']} %
% endif
% if data['lastmonth'][kpi]['margin'] &lt; 0.0:
% if data['lastmonth'][kpi]['margin'] is lessthan(0.0):
<span style="color: #ff0000;">▼</span>${"%.2f" % data['lastmonth'][kpi]['margin']} %
%endif
</span>