Reputation: 19
ImportError: No module named 'report_sxw', I need to develope a module that prints xls report but i am facing issues kindly help me solve it, whether odoo11 has the feature of xls or any alternative approach is there to develope a xls report in version 11.
Upvotes: 0
Views: 3891
Reputation: 465
For Odoo 11 download updated module from here.
https://github.com/OCA/reporting-engine/tree/11.0/report_xlsx
Upvotes: 1
Reputation: 664
In odoo11 for printing xls report you need to import some libraries because creating this type of file now some methods are change. Likewise
try:
import xlwt
from xlwt import Borders
except ImportError:
xlwt = None
After this you can create workbook by this way: workbook = xlwt.Workbook()
Then you can do your operations here.
Upvotes: 0
Reputation: 214
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)
<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"
/>
Upvotes: 0