From 1ae10492df25656650170c95cbc9eea962a0bf1f Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Mon, 13 Nov 2023 00:18:57 +0100 Subject: [PATCH] [FIX] web: make AutoComplete's value optional The recent use of owl AutoComplete component in the website builder broke some things (see [1]). This commit handles this bug: Steps to reproduce: - Go to /web?debug=1 - Go to the website app - Enter edit mode - Drop the text-image snippet => Traceback This was because the AutoCompleteWithPages extension of website was inheriting the AutoComplete props whose "value" prop was not optional but was not used for this case. This commit goes the easy way: make the original prop optional with the default value being the empty string. [1]: https://github.com/odoo/odoo/commit/86a9171ec7790aa09f2b9a50dcb26deb029e8bed closes odoo/odoo#141751 Signed-off-by: Quentin Smetz (qsm) --- addons/web/static/src/core/autocomplete/autocomplete.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/core/autocomplete/autocomplete.js b/addons/web/static/src/core/autocomplete/autocomplete.js index cde456b1402..fc9d9c84c98 100644 --- a/addons/web/static/src/core/autocomplete/autocomplete.js +++ b/addons/web/static/src/core/autocomplete/autocomplete.js @@ -371,7 +371,7 @@ export class AutoComplete extends Component { Object.assign(AutoComplete, { template: "web.AutoComplete", props: { - value: { type: String }, + value: { type: String, optional: true }, id: { type: String, optional: true }, onSelect: { type: Function }, sources: { @@ -398,6 +398,7 @@ Object.assign(AutoComplete, { class: { type: String, optional: true }, }, defaultProps: { + value: "", placeholder: "", autoSelect: false, dropdown: true,