From 8776306e80639f5fd8a857e7b1fb0b6801040683 Mon Sep 17 00:00:00 2001 From: Parth Choksi Date: Fri, 26 Apr 2019 09:58:59 +0000 Subject: [PATCH] [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 --- addons/digest/data/digest_template_data.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/digest/data/digest_template_data.xml b/addons/digest/data/digest_template_data.xml index 72826734049..07c0994edaf 100644 --- a/addons/digest/data/digest_template_data.xml +++ b/addons/digest/data/digest_template_data.xml @@ -56,10 +56,10 @@ Yesterday % if data['yesterday'][kpi]['margin'] != 0.0: - % if data['yesterday'][kpi]['margin'] > 0.0: + % if data['yesterday'][kpi]['margin'] is greaterthan(0.0): ▲${"%.2f" % data['yesterday'][kpi]['margin']} % % endif - % if data['yesterday'][kpi]['margin'] < 0.0: + % if data['yesterday'][kpi]['margin'] is lessthan(0.0): ▼${"%.2f" % data['yesterday'][kpi]['margin']} % % endif @@ -76,10 +76,10 @@ Last 7 Days % if data['lastweek'][kpi]['margin'] != 0.0: - % if data['lastweek'][kpi]['margin'] > 0.0: + % if data['lastweek'][kpi]['margin'] is greaterthan(0.0): ▲${"%.2f" % data['lastweek'][kpi]['margin']} % % endif - % if data['lastweek'][kpi]['margin'] <0.0: + % if data['lastweek'][kpi]['margin'] is lessthan(0.0): ▼${"%.2f" % data['lastweek'][kpi]['margin']} % %endif @@ -96,10 +96,10 @@ Last 30 Days % if data['lastmonth'][kpi]['margin'] != 0.0: - % if data['lastmonth'][kpi]['margin'] > 0.0: + % if data['lastmonth'][kpi]['margin'] is greaterthan(0.0): ▲${"%.2f" % data['lastmonth'][kpi]['margin']} % % endif - % if data['lastmonth'][kpi]['margin'] < 0.0: + % if data['lastmonth'][kpi]['margin'] is lessthan(0.0): ▼${"%.2f" % data['lastmonth'][kpi]['margin']} % %endif