Hello,
I'm working on Odoo 11, and i have a button to print XLS Report, I generate the report successfully using the xlswriter library but i don't know what should i return in the function in order to allow the user to download the XLS file.
Please, see the code bellow and tell me what should i put instead of *****?
def generate_excel_report(self):
self.calculate_validation_lines()
workbook = xlsxwriter.Workbook("Stock valuation report {0} to {1}".format(str(self.date_from), str(self.date_to)))
for company in self.all_companies:
if self.has_valuation(company):
sheet = self.create_worksheet(workbook, company)
row = 9
col = 0
for line in self.stock_valuation_lines:
if line.product_id.company_id == company:
sheet.write(row, col, line.product_id.categ_id.name)
sheet.write(row, col+1, line.product_id.name)
sheet.write(row, col+2, line.product_id.barcode)
sheet.write(row, col+3, line.product_id.default_code)
sheet.write(row, col+4, line.beginning_qty)
sheet.write(row, col+5, line.received_qty)
sheet.write(row, col+6, line.sale_qty)
sheet.write(row, col+7, line.internal_qty)
sheet.write(row, col+8, line.adjustment_qty)
sheet.write(row, col+9, line.ending_qty)
sheet.write(row, col+10, line.cost)
sheet.write(row, col+11, line.total_value)
workbook.close()
return *****