Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.
Module: Discuss
Entity: mail.composer.mixin
Compute Method: _compute_body_has_template_value
| Inputs | Method | Outputs |
|---|---|---|
|
""" Computes if the current body is the same as the one from template.
Both real and sanitized values are considered, to avoid editor issues
as much as possible. """
for composer_mixin in self:
if not tools.is_html_empty(composer_mixin.body) and composer_mixin.template_id:
template_value = composer_mixin.template_id.body_html
- sanitized_template_value = tools.html_sanitize(template_value)
- composer_mixin.body_has_template_value = composer_mixin.body in (template_value, sanitized_template_value)
+ # matching email_outgoing sanitize level
+ sanitize_vals = {
+ 'output_method': 'xml',
+ 'sanitize_attributes': False,
+ 'sanitize_conditional_comments': False,
+ 'sanitize_form': True,
+ 'sanitize_style': True,
+ 'sanitize_tags': False,
+ 'silent': True,
+ 'strip_classes': False,
+ 'strip_style': False,
+ }
+ sanitized_template_value = tools.html_sanitize(template_value, **sanitize_vals)
+ composer_mixin.body_has_template_value = composer_mixin.body in (template_value,
+ sanitized_template_value)
else:
composer_mixin.body_has_template_value = False
|
|
