From b069816bdcc720cd6a603586efeb56bd4770c3b1 Mon Sep 17 00:00:00 2001 From: Justine Doutreloux Date: Wed, 16 Aug 2023 11:25:10 +0200 Subject: [PATCH] [FIX] cmis_web: fix rendering of FieldCmisDocument In some cases the render gets triggered a second time and the empty value becomes false again. This causes the wrong template to be rendered and creates an error. --- cmis_web/static/src/js/form_widgets.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmis_web/static/src/js/form_widgets.js b/cmis_web/static/src/js/form_widgets.js index 19ed24bc..1747a8d7 100644 --- a/cmis_web/static/src/js/form_widgets.js +++ b/cmis_web/static/src/js/form_widgets.js @@ -1042,12 +1042,12 @@ odoo.define('cmis_web.form_widgets', function (require) { _render: function () { this._super.apply(this, arguments); - if (this.value === "empty") { - this._renderNoDocument(); - } else if (this.value === "__error__") { + if (this.value === "__error__") { this._renderGetError(); - } else if (this.document) { + } else if (this.value && this.value !== "empty" && this.document) { this._renderCmisDocument(this.document); + } else { + this._renderNoDocument(); } this.$el.find('.dropdown-menu').off('mouseleave');