Odoo Help


How do i return a report with multiple duplicate keys

Tarun Behal
on 5/4/14, 11:47 AM 822 views

I've a function which return a pdf report return { 'type': 'ir.actions.report.xml', 'report_name':'hotel.product.label', 'datas': { 'model':'hotel.product', 'ids': pids and pids or [], 'report_type': 'pdf' }, 'nodestroy': True }

pids is list of ids with duplicate keys eg: pids = [1,1,1,2,2,2,2,2,3,3,3]

The function returns a report for only unique ids i.e. [1,2,3] only. I did debugging and saw that werkzeug serving.py line #130 assert type(data) is str, 'applications must write bytes' self.wfile.write(data) self.wfile.flush()

has all keys in data attribute which is last function called before returning the report. Please let me know if to provide more specifications for the issue. Any guidance or help would be highly appreciated.

Regards, Tarun Behal tarunbehal@hotmail.com

Tarun Behal
On 6/17/14, 12:16 PM

Hi Lithin,

Appreciate for your response. But this wont work. Let me explain how list and sets work. First of all you need to clear your concepts on sets and lists. Very basic definitions as per usage of sets and lists is below

Sets - collection of unique elements. For eg: sets of number  [1,2,3] where all elements are unique. If you create a set of [1,1,2,3] it will remove duplicate entries and will transform it to [1,2,3]. Sets work in same way as dictionaries in python. So you can think of sets as dictionary with only keys.

Sets work by creating index of each value, so if index of a particular key is already filled, then that value is replaced, thus, eliminating duplicates. This indexing provides better performance in sets just like dictionaries.


Lists - collection of elements. For eg: [1,1,2,3]. You can put as many duplicate values you want in the list.

List works by simply storing each value at a address. It doesnt cares about whatever values you are storing in list.


Thus your solution wont work as my initial pids ([1,1,1,2,2,2,2,2,3,3,3]) after your set operation will become set of [1,2,3] and further list operation will transform it to list of [1,2,3].


let me know if you face any difficulty in understanding.

Lithin T
On 5/5/14, 5:16 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 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

0 follower(s)


Asked: 5/4/14, 11:47 AM
Seen: 822 times
Last updated: 3/16/15, 8:10 AM