如何将行号添加到树视图?

2024-05-09 02:09:34 发布

您现在位置:Python中文网/ 问答频道 /正文

我需要在树视图中添加行号,这样用户就可以知道表上的记录数了。有可能吗?在

我正在用python2.7开发odoo8


Tags: 用户视图记录odoo8行号
2条回答

希望你知道主干网.js

对于这个解决方案,您可以在js端的TreeView中使用include,比如:instance.web.ListView.include()

并像TreeView一样显示每行的行号。在

已经有一个paid app。在

For more reference refer this link还有。在

在树状图中添加行号而不创建新模块。请按照以下步骤进行更改,如下所示。在

Stpe-1:打开基本.xml文件驻留在web模块中。(/web/static/src/xml/基本.xml)在

第2步:在文件中搜索<th t-if="options.selectable" width="1" >。在

Stpe-3:在上述搜索行之前添加行<th width="1">#</th>。在

例如

<th width="1">#</th>
<th t-if="options.selectable" width="1"  >

Stpe-4:在文件中搜索<t t-set="record" t-value="records.at(index)"/>,并在该行之后添加行<t t-set="row_number" t-value="index+1"/>。在

第5步:搜索<th t-if="options.selectable" class="oe_list_record_selector" width="1">并在该行之前添加行<th width="1"><t t-esc="row_number" /> </th>

^{pr2}$

第6步:在文件中的行下方搜索

<t t-set="columns_count" t-value="visible_columns.length + (options.selectable ? 1 : 0) + (options.deletable ? 1 : 0)"/>

用下面的线代替它

<t t-set="columns_count" t-value="visible_columns.length + (options.selectable ? 1 : 0) + (options.deletable ? 1 : 0) + 1"/>

一切都完成了。只需在浏览器中用Ctrl+F5重新加载Odoo,您将在树状视图中看到行号。在

更新: 从这里下载模块Row Number in List view

相关问题 更多 >

    热门问题