Odoo Help


How to: Backend Bootstrap CSS checkbox toggle

on 9/4/15, 6:00 PM 2,416 views

Thanks for anyone who can contribute.

I am trying to use a bootstrap toggle checkbox widget in odoo 8 backend. I kind of cheated and just added the links to the /web/views/webclient_templates.xml file at the end of all the links and script references. Unfortunately its not working. My checkbox simply looks like a regular old checkbox. I have used the exact code and had it work in the odoo website frontend however the backend is refusing to cooperate. Any hints?

I have tried

- Adding to /web/views/webclient_templates.xml

-Adding directly to my view.xml file

-Overriding the backend template like this

<?xml version="1.0" encoding="utf-8"?>
<template id="assets_backend" name="myModule assets" inherit_id="web.assets_backend">
<xpath expr="link[last()]" position="after">
<link rel="stylesheet" href="/myModule/static/src/css/bootstrap-toggle.css" t-ignore="true"/>
<xpath expr="script[last()]" position="after">
<script type="text/javascript" src="/myModule/static/src/js/bootstrap-toggle.js"></script>


Parikshit Vaghasiya

--Parikshit Vaghasiya--
| 6 3 8
--Parikshit Vaghasiya--

Working as an OpenERP/Odoo developer both experience in web and addons. you can contact me at:

E-mail : parikshitvaghasiya@gmail.com

Blog : parikshitvaghasiya.blogspot.in

Stackoverflow : http://stackoverflow.com/users/5089106/parikshit-vaghasiya

Parikshit Vaghasiya
On 9/16/15, 10:43 AM

Hello ,
Here is your solution :

        <template id="custom_assets_backend" name="custom assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/myModule/static/src/js/bootstrap-toggle.js"/>
<link rel="stylesheet" href="/myModule/static/src/css/bootstrap-toggle.css"/>
Hope this will help you ..

Please accept answer if it is useful for you. Thank you in advance.!!

Parikshit Vaghasiya
on 9/16/15, 10:44 AM
On 9/15/15, 7:11 PM

Try this widget. I actually expanded on the existing boolean field. Yes I am answering my own question with a widget I patched together.

Once installed define your boolean as such.

<field name="myboolean" widget="bs_toggle"/>


About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 9/4/15, 6:00 PM
Seen: 2416 times
Last updated: 9/16/15, 10:43 AM