一、在static文件夹下新建一个css文件夹并将*.css文件写入
/*该文件用来定义视图中的一些格式,需要用到的地方直接在xml文件中进行引用*/
/*语法说明*/
/*
table th:nth-child(1) 代表定位到table 的 th上面到第一个th标题
nth-child()参考 css语法http://www.w3school.com.cn/cssref/css_selectors.asp
:nth-child(1) 表示 第1个元素
:nth-child(even) 表示 偶数
:nth-child(odd) 表示 奇数
:表示所有(未在od中测试)
*/
/*
!important 作用是权重作用 权重最大,样式有优先级
*/
/*样式 树形列表中所有标题居中 这里利用奇数和偶数都居中的语法 *
/*样式 树形列表中元素p根据序数进行标题居中设置*/
.melon_fix_width_tree_style_p1 table th:nth-child(even) {
width:200px !important;
/*background-color: red !important;*/
}
.melon_fix_width_tree_style_p1 table th:nth-child(odd) {
width:200px !important;
/*background-color: #3168a7 !important;*/
}
二、在xml的tree上定义一个class
<!-- tree视图 -->
<record id="view_melon_execute_detail_tree" model="ir.ui.view">
<field name="name">melon_execute_detail_tree</field>
<field name="model">melon_execute_detail</field>
<field name="arch" type="xml">
<tree string="无极执行明细" create="0" class="melon_fix_width_tree_style_p1">
<field name="short_sz" optional="show" width="200px"/>
</tree>
</field>
</record>
三、最重要一步是在__manifest__文件里面写入
'assets': {
'web.assets_backend': [
'your_model/static/src/css/base.css',
],
},
然后升级模型即可看到效果
心有猛虎,细嗅蔷薇