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
- Kế toán
- Tồn kho
- PoS
- Dự án
- MRP
Câu hỏi này đã bị gắn cờ
1
Trả lời
4001
Lượt xem
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/Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng ký