This question has been flagged
2 Replies
6638 Views

I already created the xml and css file, I added the xml in the manifest then inside the xml I inherit my css file. 


My question is, what will be the css file look like?

In my template file, I have the style tag and inside of it are my custom designs but I want to transfer it to the static folder, to make my template file look clean and also follow the odoo arrangement.


<style type="text/css">
thead{
font-size:15px;
border-bottom: 2px solid black;
}

tbody{
font-size:10px;
border-collapse: collapse;
}

.total-row{
font-weight: bold;
font-size:10px;
}

.header{
margin-top:30px;

}

.table-shrinkage{
width:100%;
overflow-x:auto;
}

.text-upper-text-head {
text-align:left;
}

.text-lower-text-head{
text-align:left;

}

.table-header{
border-style:solid;
}

td{
border-bottom: 1px solid black;
}

</style>


How can I transfer it to the static folder ? What will be inside the css file look like, do I have to just copy the style above?

Avatar
Discard
Best Answer

Please read the following tutorial from Yenthe: https://www.odoo.yenthevg.com/adding-static-resources-css-and-javascript-to-odoo/

Please be aware that by using fixed measures (such as px) you may overrule the default responsive styles based on media queries.

Avatar
Discard
Author

Dear Ermin,

I followed the steps from the site and I tried to add a border in my table inside the template but it applies to all then I tried to put a class name in my table and used that name in my css but don't have any effects

My answer showed you how to properly static resources to Odoo, but if your CSS is wrong, then it is not an Odoo topic anymore :-(

Best Answer

You can take a look at the default module (web) from odoo about the file placing convention.

I guess webclient_templeate.xml and the manifest of the web module are what you needed.

Avatar
Discard
Author

Dear Wayne,

I open the module and followed what it is inside the web module to my module then it doesn't take any effects,

Do you include inherit_id in your template tag? Do you add them to the web.assets by xpath?

i.e., <template id="your_style_sheet" inherit_id="web.assets_backend">

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