Why 'window.addEventListener("hashchange",...' or 'window.onhashchange' JS events are not working on odoo15 backend? Whereas they are working fine until odoo14. What has changed? Or any other workaround for this event? I am not able to capture the changes of hash values of URLs while traversing in the backend in odoo 15 only. They are working fine in odoo 13,14 etc.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
4046
Lượt xem
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
2
thg 12 22
|
2638 | ||
|
2
thg 5 22
|
14153 | ||
|
2
thg 4 22
|
4279 | ||
|
1
thg 4 22
|
3368 | ||
|
1
thg 11 19
|
18503 |
In Odoo 15, the backend URL structure has changed, so the hashchange event is no longer triggered when navigating between pages. This is because the URL now uses a route system rather than hashes to indicate the current page.
To detect changes in the current route, you can use the odoo.__DEBUG__.services['web_tour.tour'].router.current_route variable in your JavaScript code. You can listen for changes to this variable and perform any necessary actions when it is updated.
Alternatively, you can use the web_tour.tour service to listen for route changes and trigger your custom code. Here is an example:
odoo.define('my_module.route_listener', function (require) {
'use strict';
var Tour = require('web_tour.tour');
Tour.register({
id: 'my_route_listener',
name: 'My route listener',
path: '/web', // or any other route you want to listen to
mode: 'test',
onChange: function (page, next) {
// your custom code here
// `page` is the current route
next();
},
});
});