Odoo Help


odoo 8 how to do sorting in point of sale "sale details report" ?

on 4/3/15, 9:19 AM 1,316 views

I would like to sort sale details report in ascending order, could someone help?

I have identified 3 files and sorted function but not sure what to do with them. 




records.sorted(key=lambda r: r.name)



| 6 5 7
Lodz, Poland

On 4/3/15, 10:11 AM

You must inherit class pos_details() in your module and add order='date_start asc' clause, like this:

class pos_details(osv.osv_memory):
      _inherit = 'pos.details'

def print_report(self, cr, uid, ids, context=None):
if context is None:
context = {}
datas = {'ids': context.get('active_ids', [])}

res = self.read(cr, uid, ids, ['date_start', 'date_end', 'user_ids'], order='date_start asc', context=context)
# or # res = self.read(cr, uid, ids, ['date_start', 'date_end', 'user_ids'], order='date_end asc', context=context)

res = res and res[0] or {}
datas['form'] = res
if res.get('id',False):
return self.pool['report'].get_action(cr, uid, [], 'point_of_sale.report_detailsofsales', data=datas, context=context)

pos details as far as I know only kept the start date, end date, user ID etc for printing pos orders and details , I wonder how the above class can sort the order base on order date?

on 4/3/15, 10:29 AM

Sorry, my mistake. Answer updated.

on 4/3/15, 1:14 PM

zbik, currently I can make changes directly in addons/views/report_detailsofsales.xml and it will get change after I do an upgrade, but when I try to make changes in addons/report/pos_details.py , follow the same process to upgrade the changes is not reflected at all. could you help?

on 5/9/15, 10:05 PM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 4/3/15, 9:19 AM
Seen: 1316 times
Last updated: 4/3/15, 8:15 PM