Row Number in tree/list view

by
Odoo 10
v 13.0 Third Party 5401
Download for v 13.0 Deploy on Odoo.sh Live Preview
Technical Name rowno_in_tree
LicenseLGPL-3
Also available in version v 10.0 v 12.0 v 9.0 v 11.0 v 8.0
You bought this module and need support? Click here!
Technical Name rowno_in_tree
LicenseLGPL-3
Also available in version v 10.0 v 12.0 v 9.0 v 11.0 v 8.0

Show Number in List/Tree View

You can see the row number in tree/list view in Odoo backend list views.

You would love to have our other Apps!



Contact us for support, customization

Write us

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author, please use the developer contact information. They can usually be found in the description.
Please choose a rating from 1 to 5 for this module.
Nice module
by
Lima Saudara
on 4/23/20, 3:58 AM

This helps me enough :)


by
suraj james
on 3/31/20, 1:55 AM

Hi Nilesh, When using section and notes, the you are applying the wrong class and the row doesn't look consistent with the default odoo. Otherwise, your code is perfect.


list_view.js
by
suraj james
on 3/27/20, 10:42 AM

///////PLEASE UPDATE YOUR CODE for list_view.js////// //// FIXED THE BUGGY LOOK FOR THE ROW WHERE THE # COL IS DISPLAYED ALSO///// //variable to determine number of sections/notes var numSectionsNotes = 0; odoo.define('rowno_in_tree.ListNumber', function (require) { "use strict"; var core = require('web.core'); var ListRenderer = require('web.ListRenderer'); var _t = core._t; ListRenderer.include({ _getNumberOfCols: function () { var columns = this._super(); columns +=1; return columns; }, _renderFooter: function (isGrouped) { var $footer = this._super(isGrouped); $footer.find("tr").prepend($('

')); return $footer; }, _renderGroupRow: function (group, groupLevel) { var $row = this._super(group, groupLevel); if (this.mode !== 'edit' || this.hasSelectors){ $row.find("th.o_group_name").after($('')); } return $row; }, _renderGroups: function (data, groupLevel) { var self = this; var _self = this; groupLevel = groupLevel || 0; var result = []; var $tbody = $(''); _.each(data, function (group) { if (!$tbody) { $tbody = $(''); } $tbody.append(self._renderGroupRow(group, groupLevel)); if (group.data.length) { result.push($tbody); // render an opened group if (group.groupedBy.length) { // the opened group contains subgroups result = result.concat(self._renderGroups(group.data, groupLevel + 1)); } else { // the opened group contains records var $records = _.map(group.data, function (record,index) { //Nilesh if (_self.mode !== 'edit' || _self.hasSelectors){ return self._renderRow(record).prepend($("").html(index+1)); //.prepend($('')); } else{ return self._renderRow(record); } }); result.push($('').append($records)); } $tbody = null; } }); if ($tbody) { result.push($tbody); } return result; }, _renderHeader: function (isGrouped) { //reset the number of Sections/Notes count when rendering the header numSectionsNotes = 0; var $header = this._super(isGrouped); if (this.hasSelectors) { $header.find("th.o_list_record_selector").before($('').html('#')); var advance_search = $header.find("tr.advance_search_row") if(advance_search.length && advance_search.find('td.o_list_row_number_header').length==0){ advance_search.prepend($('').html(' ')); } } else{ if (this.mode !== 'edit'){ $header.find("tr").prepend($("").html('#')); } } //$header.find("tr").prepend($('').html('#')); return $header; }, _renderRow: function (record) { var $row = this._super(record); var isSection = record.data.display_type === 'line_section'; var isNote = record.data.display_type === 'line_note'; if (this.mode !== 'edit' && this.state.groupedBy.length==0){ var index = this.state.data.findIndex(function(e){return record.id===e.id}) if (index!==-1){ //do not show row numbers for sections or notes if (isSection || isNote){ numSectionsNotes +=1; $row.prepend($("").html("")); } else{ $row.prepend($("").html(index-numSectionsNotes+1)); } } } return $row; }, }); });
Re: list_view.js
by
Nilesh Patel
on 3/31/20, 12:13 AM Author

Hello Dear, there is no bug in my code, your requirements is different, so its not showing as per your requirements. If you want to see row number in list view, its showing well without any error.


by
suraj james
on 3/23/20, 5:20 AM

Hi Nilesh, how can we skip the row numbers for Sections/Notes in Sale order lines