Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
10411 มุมมอง


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"?>
<openerp>
<data>
<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>
<xpath expr="script[last()]" position="after">
<script type="text/javascript" src="/myModule/static/src/js/bootstrap-toggle.js"></script>
</xpath>
</template>
</data>
</openerp>

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

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"/>
</xpath>
</template>
Hope this will help you ..
อวตาร
ละทิ้ง

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

ผู้เขียน คำตอบที่ดีที่สุด

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"/>

https://github.com/aimsystems/odoo_web_toggle

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
เม.ย. 22
3777
11
เม.ย. 25
89923
4
เม.ย. 23
7681
How to change colors of a survey? แก้ไขแล้ว
1
พ.ค. 25
449
1
เม.ย. 20
9699