[FIX] web_editor: Html Field in Record

Using the web_editor html field in the Record component causes crashes.

Why does this happen?
The fields used in the Record component do not always have modifiers.

Solution:
Use the isReadonly function of the record to know if the field is
readonly or not.

closes odoo/odoo#113072

X-original-commit: 5354321877b65d577c419255ce43806f648e1708
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
FrancoisGe
2023-02-20 08:28:40 +01:00
parent 2616dd6aae
commit 4c8d5dbcfe
@@ -141,7 +141,7 @@ export class HtmlField extends Component {
// Ensure all external links are opened in a new tab.
retargetLinks(this.readonlyElementRef.el);
const hasReadonlyModifiers = Boolean(this.props.record.activeFields[this.props.fieldName].modifiers.readonly);
const hasReadonlyModifiers = Boolean(this.props.record.isReadonly(this.props.fieldName));
if (!hasReadonlyModifiers) {
const $el = $(this.readonlyElementRef.el);
$el.off('.checklistBinding');