diff options
| author | Jason Van Malder <jvm@odoo.com> | 2020-01-30 08:16:33 +0000 |
|---|---|---|
| committer | Jason Van Malder <jvm@odoo.com> | 2020-01-31 17:20:34 +0000 |
| commit | cf2f53e4cf4e8f5e2e2d23c5aaf4554630be68c8 (patch) | |
| tree | a71673dfbb77e8b11737acd37ba02b9e6cf5e9a2 /addons/web_editor/static/src/js/backend/field_html.js | |
| parent | 58732e4dc80234f9fdbf560101aac8a40ddd325c (diff) | |
[FIX] web_editor: fix required html fields
Issue
- Studio
- Add an required html field
- Create new record
- Leave it empty
It is saved
Cause
The isSet function of FieldHtml widget, have a "/" in the <br> tag
and summernote empty = <p><br></p>. If you add a space, the value
becomes <p> <p>.
Solution
Remove the "/" and the spaces, check if value != <p></p> &&
<p><br></p>
OPW-2183687
closes odoo/odoo#44427
X-original-commit: c984b1b1210cea1e63f3bc66cec2120554c76c2a
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Diffstat (limited to 'addons/web_editor/static/src/js/backend/field_html.js')
| -rw-r--r-- | addons/web_editor/static/src/js/backend/field_html.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/web_editor/static/src/js/backend/field_html.js b/addons/web_editor/static/src/js/backend/field_html.js index 0fe35887a7b..75548eee4b8 100644 --- a/addons/web_editor/static/src/js/backend/field_html.js +++ b/addons/web_editor/static/src/js/backend/field_html.js @@ -116,7 +116,8 @@ var FieldHtml = basic_fields.DebouncedField.extend(TranslatableFieldMixin, { * @override */ isSet: function () { - return this.value && this.value !== "<p><br/></p>" && this.value.match(/\S/); + var value = this.value && this.value.split(' ').join('').replace(/\s/g, ''); // Removing spaces & html spaces + return value && value !== "<p></p>" && value !== "<p><br></p>" && value.match(/\S/); }, /** * @override |
