Can anybody please tell me how to do pagination and sorting of fields in jasper reports in OpenERP
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
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
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
0
thg 3 15
|
3543 | ||
|
1
thg 11 17
|
8690 | ||
|
1
thg 8 25
|
674 | ||
|
1
thg 4 25
|
1629 | ||
|
1
thg 9 24
|
2340 |