Skip to content
Snippets Groups Projects
Commit c71af144 authored by Benjamin Vray's avatar Benjamin Vray
Browse files

[FIX] website: fix add menu item dialog traceback

Steps to reproduce the bug:

- Website application
- Go to Website
- Go to menu "Pages"
- Click on "Edit Menu"
- Click on "Add Menu Item"
- Bug: This leads to a traceback.

This bug was introduced by the commit [1], where we do a
"querySelectorAll" on the anchor selector element, which doesn't
actually exist in the "Add Menu Item" dialog. The code related to adding
an anchor shouldn't be executed in this modal. This was changed in
versions higher than 14, where we separated the code used in the
"Add Menu Item" dialog from the code used for editing links in edit
mode.

In this commit, we fix this issue minimally by adding a "return"
statement if the anchor selector element doesn't exist.

[1]: https://github.com/odoo/odoo/commit/c9dbfd35ffda80f0ad07288f13ce9d0dde9591f2



opw-3422898

closes odoo/odoo#129710

Signed-off-by: default avatarRomain Derie (rde) <rde@odoo.com>
parent 1869260a
No related branches found
No related tags found
No related merge requests found
......@@ -46,6 +46,9 @@ weWidgets.LinkDialog.include({
_adaptPageAnchor: function () {
var urlInputValue = this.$('input[name="url"]').val();
var $pageAnchor = this.$('.o_link_dialog_page_anchor');
if (!$pageAnchor.length) {
return;
}
var isFromWebsite = urlInputValue[0] === '/';
var $selectMenu = this.$('select[name="link_anchor"]');
var $anchorsLoading = this.$('.o_anchors_loading');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment