Odoo Help

Welcome!

This community 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.

4

Pagination and Sorting in Jasper Reports

By
Jamshid Chungath
on 4/16/14, 1:20 AM 2,547 views

Can anybody please tell me how to do pagination and sorting of fields in jasper reports in OpenERP

1
Abhishek H Menon
On 4/16/14, 5:17 AM

For enabling pagination, Add the below method in your python report parser

def generate_parameters(self, cr, uid, ids, data, context):
        if data['report_type']=='xls':
            return {'IS_IGNORE_PAGINATION':True}
        return {}

And then to sort the list of dictionaries, there are two methods. One is in the above mentioned answer by Ashif Abdulrahman and the other one is using itemgetter.

from operator import itemgetter

and then to sort a list of dictionaries,

list_1 = sorted(list_1, key=itemgetter('key_1','key_2','key_3',.......))

where list_1 is the list of dictionaries which you obtained during the output of the parser, key_1,key_2, ..are the keys of the dictionaries in that result list list_1.

Thanks Abhishek

Jamshid Chungath
on 4/17/14, 2:25 AM
1
Ashif Abdulrahman
On 4/16/14, 3:46 AM

you can sort the fields when passing from the function generate_records, like...

result = sorted(result, key=lambda d: (d['delivery_date'],d['partner']))

and then pass the sorted result

what we are doing is html format report so...my boss need dynamic sorting when report appear,a link to sort when clicking the report ,report should sort...like that Thanks,

Jamshid Chungath
on 4/17/14, 2:23 AM

Your Answer

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

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 4/16/14, 1:20 AM
Seen: 2547 times
Last updated: 3/16/15, 8:10 AM