I have a character type field which its value sometimes contain <
,>
or &
,
when I use report, odoo automatically convert it as <
.
I have tired use js export and import to get an external function to convert. (I can not put this function in view template, because if the template contain <,> or &, python interpreter can't parse file with these characters.)
var convert= function (str) {
return str.replace(/</g,'<').replace(/>/g,'>').replace(/&/g,'&');
};
export {convert};
this file path is my_module/static/src/js/js1.js
And in same module I have a view template import it as:
<script type="text/javascript">
import {convert} form "/my_module/static/src/js/js1.js"
.
.
.
<t t-foreach="docs" t-as="doc">
<t t-esc="doc.surfhrd"/>
.
.
.
And get no data since import line is added.
I expect this can convert the html character to its origin appearing.
And I sure this function can work that I have tested in browser's developer tools console.