I actually, I try to find the solution to print all the Financial Report like the excel sheet but I don't find the solution yet because now on work, it still print out the pdf file so if anyone know how to generate the pdf to excel sheet in odoo 8 please kindly free to answer me! Thank you before hand!
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
1
Reply
3383
Views
Hi Sopha Sum,
In odoo v8 qweb Excel report is out of box. If you want to generate Excel report you need to customize. And this can be done by importing xlsxwriter package. There are built in methods available so it will help you out.
Sample code:
// .py code
'filename' : fields.char("File Name", size=64)
'excel_file' : fields.binary('Excel File')
filename = "Test.xlsx"
fp = StringIO()
workbook = xlsxwriter.Workbook(fp)
worksheet = workbook.add_worksheet('Report')
.....
workbook.close()
self.write({'excel_file': base64.encodestring(fp.getvalue()), 'filename': filename})
fp.close()
return {
'view_mode': 'form',
'res_id': self.id,
'res_model': 'test.test',
'view_type': 'form',
'type': 'ir.actions.act_window',
'context': self.env.context,
'target': 'new',
}
// xml code
<field name="filename" invisible="1"/>
<field name="excel_file" filename="filename" readonly="1"/>
Reference links http://xlsxwriter.readthedocs.io/
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up