I created a sequence field as a function field to show the number of records in browse starting from '1', regardless the 'id' value of the record.
I used the following code
def _get_sequence(self, cr, uid, ids, fields, args, context=None): res={} line_o = self.pool.get('budget.transaction.line') for o in self.browse(cr,uid,ids): res[o.id] = 1+line_o.search_count(cr,uid,[('id','<',o.id)]) return res _columns = { ...
ondelete='cascade', select=True, required=True), 'sequence': fields.function(_get_sequence,string='Sequence',type='integer', help="Gives the sequence order when displaying a list of lines."),
The issue with me now is that I need this numbering to be recalculated if I changed the filter of applied on the browse from the advanced search option. How to achieve this. Any help is appreciated.