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

Hello All,


How to add custom css class directly in Qweb report template?


Regards,

Prince



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

Another way is Style element

<div class="page"> 
    <div class="oe_structure"/>
    <div class="row">
   <div class="col-xs-6">
             <style>
                 .class-name{border:1px solid lightgray; margin-left:16px;}
             <style>


                 ..........

         </div>
    </div>
</div>


อวตาร
ละทิ้ง

Additional note: the style element has to be placed inside the page div. It won't work if it is placed before.

คำตอบที่ดีที่สุด

You can use style="...." directly in qweb


<div class="col-xs-5" style="border:1px solid lightgray; margin-left:16px;">
อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi Prince Caspion,

Kindly follow below step to create custom css class.

1.How to create css file in custom module.  

You should follow file structure like -

your_module_name/static/src/css/your_module_name.css

css file like:

.custom_css {

background-color: yellow;

}

2.Register your css file in main report template file like.

<template id="assets_common" name="your_module_name assets" inherit_id="report.assets_common">

 <xpath expr="." position="inside">

     <link href="/your_module_name/static/src/css/your_module_name.css" rel="stylesheet"/>

 </xpath>

</template>

3.How to access css class in your report template.

<div class="text-center custom_css"><b>** Thank you **</b></div>


Hope this help you.

Best Thanks,

Ankit H Gandhi.

อวตาร
ละทิ้ง

Inherit id: inherit_id="web.report_assets_common"

คำตอบที่ดีที่สุด

https://www.odoo.com/forum/help-1/question/how-to-add-a-custom-css-5783

3Laurent DestailleurOn 1/7/15, 4:05 PM
If you are using Odoo v8, you must add this
        <template id="assets_backend" name="mymodule css assets" inherit_id="web.assets_backend">
            <xpath expr="." position="inside">
                <link rel="stylesheet" href="/my_module/static/src/css/my_module_css_file.css"/>            </xpath>        </template>


Does it work?

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ต.ค. 16
3303
Including css file to odoo แก้ไขแล้ว
2
ก.พ. 24
16700
0
เม.ย. 20
2488
3
ส.ค. 18
10172
2
ก.พ. 24
2297