I am trying to print some fields of account.invoice and account.invoice.line
Firstly I added the button for printing csv formatted report.
this is i trying in code
def print_csv(self): lines = [] lines.append((['Product Name','Price Unit','Quantity'])) for rec in self.invoice_line_ids: lines.append(([rec.product_id.name,rec.price_unit,rec.quantity])) with open('invoice_details.csv', 'w') as fp: a = csv.writer(fp, delimiter=',') data_lines = lines a.writerows(data_lines)
the csv file file is downloaded in not browser,it is downloaded in the default location.
How to redirect to the file to download in web browser??
I know this can implemented using controllers in odoo. is there any good example of controller to print csv report??