Hello Ajini,
i am not perfectly able to help you, but i can help you how to create XLS report in odoo and set into binary field that you can download. Just follow bellow step.
# import packages required for writing XLS data
from io import BytesIO
import xlwt, base64
# Define one field that temporary hold data for download
file = fields.Binary('XLS File', readonly=True)
# Do bellow stuff in onchange / method or button click function to write XLS
# set sheet name and format
FP = BytesIO()
WB = xlwt.Workbook(encoding='utf-8')
writer = WB.add_sheet('Sheet Name')
row = 1
col = 0
header_cols = 4
# Set sheet first row (for header purpuse)
writer.write_merge(row, row, 0, header_cols, "Contacts information", "you can apply css style here for fiest column like: height: 200px;")
row += 1
# write data (for column title)
writer.write(row, col + 1, "Name", "font-weight:bold;")
writer.write(row, col + 2, "Email", "font-weight:bold;")
writer.write(row, col + 3, "Phone", "font-weight:bold;")
row += 1
col = 0
# Set data
writer.write(row, col + 1, "A", "font-weight:normal;")
writer.write(row, col + 2, "B", "font-weight:normal;")
writer.write(row, col + 3, "C", "font-weight:normal;")
WB.save(FP)
# set file to binary field
self.file = base64.encodestring(FP.getvalue())
Hope it will help you to do what you want.
I think you have to add this code to loop for printing One2many data.
Accept and upvote answer if helpful
Thanks and regards
Haresh Kansara