<p>在树状图中添加行号而不创建新模块。请按照以下步骤进行更改,如下所示。在</p>
<p><strong>Stpe-1:</strong>打开基本.xml文件驻留在web模块中。(/web/static/src/xml/基本.xml)在</p>
<p><strong>第2步:</strong>在文件中搜索<strong><code><th t-if="options.selectable" width="1" ></code></strong>。在</p>
<p><strong>Stpe-3:</strong>在上述搜索行之前添加行<strong><code><th width="1">#</th></code></strong>。在</p>
<p>例如</p>
<pre><code><th width="1">#</th>
<th t-if="options.selectable" width="1" >
</code></pre>
<p><strong>Stpe-4:</strong>在文件中搜索<strong><code><t t-set="record" t-value="records.at(index)"/></code></strong>,并在该行之后添加行<strong><code><t t-set="row_number" t-value="index+1"/></code></strong>。在</p>
<p><strong>第5步:</strong>搜索<strong><code><th t-if="options.selectable" class="oe_list_record_selector" width="1"></code></strong>并在该行之前添加行<strong><code><th width="1"><t t-esc="row_number" /> </th></code></strong></p>
^{pr2}$
<p><strong>第6步:</strong>在文件中的行下方搜索</p>
<pre><code><t t-set="columns_count" t-value="visible_columns.length + (options.selectable ? 1 : 0) + (options.deletable ? 1 : 0)"/>
</code></pre>
<p>用下面的线代替它</p>
<pre><code><t t-set="columns_count" t-value="visible_columns.length + (options.selectable ? 1 : 0) + (options.deletable ? 1 : 0) + 1"/>
</code></pre>
<p>一切都完成了。只需在浏览器中用Ctrl+F5重新加载Odoo,您将在树状视图中看到行号。在</p>
<p><strong>更新:</strong>
从这里下载模块<a href="https://apps.odoo.com/apps/modules/11.0/rowno_in_tree/" rel="nofollow noreferrer">Row Number in List view</a></p>