[IMP] report_xlsx_helper: black, isort

This commit is contained in:
kongrattapong
2020-01-09 11:26:17 +07:00
committed by Saran440
parent 1aaff5ac48
commit f33e647a26
7 changed files with 494 additions and 407 deletions

View File

@@ -1,21 +1,19 @@
# Copyright 2009-2018 Noviat.
# License AGPL-3.0 or later (https://www.gnuorg/licenses/agpl.html).
from odoo import api, models, _
from odoo import _, api, models
from odoo.exceptions import UserError
class IrActionsReport(models.Model):
_inherit = 'ir.actions.report'
_inherit = "ir.actions.report"
@api.model
def render_xlsx(self, docids, data):
if not self and self.env.context.get('report_name'):
report_model_name = 'report.{}'.format(
self.env.context['report_name'])
if not self and self.env.context.get("report_name"):
report_model_name = "report.{}".format(self.env.context["report_name"])
report_model = self.env.get(report_model_name)
if report_model is None:
raise UserError(
_('%s model was not found' % report_model_name))
raise UserError(_("%s model was not found" % report_model_name))
return report_model.create_xlsx_report(docids, data)
return super(IrActionsReport, self).render_xlsx(docids, data)