콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
10716 화면

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

아바타
취소
베스트 답변

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,

베스트 답변

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

관련 게시물 답글 화면 활동
0
3월 15
3549
1
11월 17
8691
1
8월 25
680
1
4월 25
1637
1
9월 24
2341