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
- Kirjanpito
- Varastointi
- PoS
- Projekti
- MRP
Tämä kysymys on merkitty
1
Vastaa
4002
Näkymät
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/Nautitko keskustelusta? Älä vain lue, vaan osallistu!
Luo tili jo tänään nauttiaksesi yksinoikeusominaisuuksista ja osallistuaksesi mahtavaan yhteisöömme!
Rekisteröidy