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
- Księgowość
- Zapasy
- PoS
- Projekt
- MRP
To pytanie dostało ostrzeżenie
1
Odpowiedz
4042
Widoki
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/Podoba Ci się ta dyskusja? Dołącz do niej!
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj się