Trợ giúp

0

How i can add script js in one web page ?

Avatar
cristian

Hi,

I want add a js in one web page not in all page of mi site.

in this way they are added in all website

<template id="website.tshop" name="Tshop" inherit_id="website.theme" priority="1">

     <xpath expr="//link[last()]" position="after">

         ...

    </xpath>

but that do not need.

please help me

Ảnh đại diện
Huỷ bỏ
3 Câu trả lời
0
Avatar
Vimesh Chaudhari
Best Answer

Hi Cristian,

Please use as below.

<template id="website.tshop" name="Tshop" inherit_id="website.theme" priority="1">

    <t t-set="head">

        <!-- Add your JS or CSS here for this particular page. -->

    </t>

</template>

Ảnh đại diện
Huỷ bỏ
0
Avatar
SALVIN Nicolas
Best Answer

Hi,

I'm developing an Odoo 10 module and I need to use custom JS and update version of bootstrap and select2.

The solution above seems to not work with Odoo 10.

I tried with : 

<template id="assets_frontend" name="my_assets_frontend" inherit_id="website.assets_frontend">
        <xpath expr="." position="inside">

But the JS is laoded in the whole website and make conflicts.

Anybody have a solution ?
Thanks
Ảnh đại diện
Huỷ bỏ
0
Avatar
cristian
Best Answer

Thanks vimesh, I'll try

Ảnh đại diện
Huỷ bỏ