我想在odoo11中以xls格式创建一个报告。我在python中有一组结果,我想在excel表中打印报告。
答案 0 :(得分:1)
Python代码: -
from odoo import models
class PartnerXlsx(models.AbstractModel):
_name = 'report.report_xlsx.partner_xlsx'
_inherit = 'report.report_xlsx.abstract'
def generate_xlsx_report(self, workbook, data, partners):
for obj in partners:
sheet = workbook.add_worksheet('Report')
bold = workbook.add_format({'bold': True})
sheet.write(0, 0, obj.name, bold)
XML代码: -
<report
id="partner_xlsx"
model="res.partner"
string="Print to XLSX"
report_type="xlsx"
name="report_xlsx.partner_xlsx"
file="res_partner"
attachment_use="False"
/>