From d84fd5274b583bf13b0a24145beb9e78884591dc Mon Sep 17 00:00:00 2001 From: "Michael (mcm)" Date: Mon, 9 Oct 2023 08:56:43 +0200 Subject: [PATCH] [FIX] website: fix autocompleteWithPages option Since the PR [1], the function autocompleteWithPages does not receive a widget anymore and does not trigger an event on it when an url is selected. Instead it is replaced by an optional function property "urlChosen" which is called if given. The error is that the optional check is wrong. The check is done on the "options" parameter, not on its optional property "urlChosen". This commit simply fixes this check. [1]: https://github.com/odoo/odoo/pull/136271 closes odoo/odoo#138047 Signed-off-by: Mathieu Duckerts-Antoine (dam) --- addons/website/static/src/js/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website/static/src/js/utils.js b/addons/website/static/src/js/utils.js index 3d1eb03bef4..d9b9d9b9a62 100644 --- a/addons/website/static/src/js/utils.js +++ b/addons/website/static/src/js/utils.js @@ -112,7 +112,7 @@ function autocompleteWithPages(rpc, $input, options) { // choose url in dropdown with arrow change ev.target.value without trigger_up // so cannot check here if value has been updated ev.target.value = ui.item.value; - options?.urlChosen(); + options.urlChosen?.(); ev.preventDefault(); }, });