In Odoo 9 there is a WYSIWYG editor which adds <p> tags on any empty line and encloses nearly every filled line with them. This totally wrecks templates. So if you have a nice email template for example for your invoice emails they will get sanitized by this editor even if you don't edit anything manually before sending.
How can we disable this behavior of the WYSIWYG editor?
Edit
The problematic function is text_to_html and can be found in addons/web_editor/static/src/js/backend.js. You can disable its very overeager behavior by simply stripping it down to something like this:
text_to_html: function (text) {
var value = text || "";
return value;
}
However, doing so in the core file will get the changes overwritten on the next update. So my question now is, what would be the correct way to override this function from a custom module. I'm familiar with basic Odoo modules to add for example new models but I'm not sure how I could override Odoo JavaScript which was defined by odoo.define and haven't found a documentation on this so far.