One option is to inherit the model in your python file and add _order to sort the date in desc or asc. Then the report will be with sorted dates.
_inherit = 'model.name'
_order = 'date desc'
Another option is to modify the getLines() to return the records sorted by date field. For example, if you are having a recordset at the end of the function, sort it by date and then return.
For eg: (if you are working with new api)
moveline_obj = self.env['account.move.line']
movelines = moveline_obj.browse([self.id])
recordset = movelines.sorted(key=lambda r: r.date)
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 10/27/15, 5:20 AM|
|Seen: 1040 times|
|Last updated: 10/27/15, 10:07 AM|