From eb94bd90b5592fc78d937003c660a8749bc10cd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20D=2E=20D=C3=ADaz?= Date: Thu, 10 Dec 2020 03:05:15 +0100 Subject: [PATCH] [FIX] web_widget_one2many_product_picker: setState when the widget was destroyed --- .../static/src/js/views/One2ManyProductPicker/record.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/web_widget_one2many_product_picker/static/src/js/views/One2ManyProductPicker/record.js b/web_widget_one2many_product_picker/static/src/js/views/One2ManyProductPicker/record.js index a8b583cf8..34d581562 100644 --- a/web_widget_one2many_product_picker/static/src/js/views/One2ManyProductPicker/record.js +++ b/web_widget_one2many_product_picker/static/src/js/views/One2ManyProductPicker/record.js @@ -148,6 +148,15 @@ odoo.define("web_widget_one2many_product_picker.One2ManyProductPickerRecord", fu * @param {Object} recordSearch */ _setState: function (viewState, recordSearch) { + + // No parent = product_pricker widget destroyed + // So this is a 'zombie' record. Destroy it! + if (!this.getParent()) { + this.on_detach_callback(); + this.destroy(); + return; + } + this.fields = this.getParent().state.fields; this.fieldsInfo = this.getParent().state.fieldsInfo.form; this.state = viewState;