Я хочу экспортировать пользовательский отчет в xlsx
.я пробую код ниже, но когда я нажимаю кнопку экспорта, это ошибка AccessDenied: Access denied
.
odoo.addons.web.controllers.main: An exception occured during an http request
Traceback (most recent call last):
File "C:\Program Files (x86)\Odoo 10.0\server\odoo\addons\web\controllers\main.py", line 72, in wrap
File "C:\Program Files (x86)\Odoo 10.0\server\odoo\addons\web\controllers\main.py", line 1480, in index
File "C:\Program Files (x86)\Odoo 10.0\server\odoo\http.py", line 118, in dispatch_rpc
File "C:\Program Files (x86)\Odoo 10.0\server\odoo\service\report.py", line 32, in dispatch
File "C:\Program Files (x86)\Odoo 10.0\server\odoo\service\security.py", line 13, in check
File "C:\Program Files (x86)\Odoo 10.0\server\odoo\addons\base\res\res_users.py", line 507, in check
AccessDenied: Access denied
Отчет XML:
<report
id="action_report_excel"
model="account.invoice"
string="Export to XLSX"
report_type="xlsx"
name="module_name.report_name.xlsx"
file="module_name.report_name.xlsx"
attachment_use="False"
/>
Код Python:
from report_xlsx.report.report_xlsx import ReportXlsx
class CustomReportXlsx(ReportXlsx):
def generate_xlsx_report(self, workbook, data, objs):
for obj in objs:
report_name = obj.name
# One sheet by partner
sheet = workbook.add_worksheet(report_name[:31])
bold = workbook.add_format({'bold': True})
sheet.write(0, 0, obj.name, bold)
CustomReportXlsx('report.module_name.report_name.xlsx', 'account.invoice')
Мастер Python:
def check_report(self):
data = {}
return self.env['report'].sudo().get_action(self, 'module_name.report_name.xlsx', data=data)
помогите мне, пожалуйста