Hi, I am developing a custom module to create several pages on a website. Does anyone know how to load a js file for each page? I ask that because If you load on web.assets.frontend 1 file this is executed every time you navigate on every page.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Contabilidad
- Inventario
- PoS
- Project
- MRP
Se marcó esta pregunta
1
Responder
2215
Vistas
Hi,
One thing you could do is check window.location.href == 'the page url' and then write the functions required for the page, or if there’s a specific class to identify the page, you can find it using jQuery and then write the code inside that.
if($(‘identifier)) {
function
}
Or you can add the script in the XML so that it only loads when the specific page loads.
Regards
¿Le interesa esta conversación? ¡Participe en ella!
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
RegistrarsePublicaciones relacionadas | Respuestas | Vistas | Actividad | |
---|---|---|---|---|
|
1
oct 18
|
3728 | ||
|
2
dic 22
|
6249 | ||
|
5
ene 22
|
11872 | ||
|
1
ago 16
|
5235 | ||
how to read field values using js
Resuelto
|
|
1
may 25
|
8424 |