Call super() in _get_report_from_name()
parent
4bb2877940
commit
d5b25af505
|
@ -1,8 +1,8 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
# © 2016-2018 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from odoo import models, fields, api
|
from odoo import api, fields, models
|
||||||
|
|
||||||
|
|
||||||
class IrActionsReportXml(models.Model):
|
class IrActionsReportXml(models.Model):
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
# © 2016-2018 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from odoo import models, api, _
|
from odoo import api, models
|
||||||
from odoo.exceptions import UserError
|
|
||||||
|
|
||||||
|
|
||||||
class Report(models.Model):
|
class Report(models.Model):
|
||||||
|
@ -11,10 +10,9 @@ class Report(models.Model):
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _get_report_from_name(self, report_name):
|
def _get_report_from_name(self, report_name):
|
||||||
reports = self.env['ir.actions.report.xml'].search([
|
res = super(Report, self)._get_report_from_name(report_name)
|
||||||
('report_type', '!=', False),
|
if not res:
|
||||||
('report_name', '=', report_name)])
|
res = self.env['ir.actions.report.xml'].search([
|
||||||
if not reports:
|
('report_type', '!=', False),
|
||||||
raise UserError(_(
|
('report_name', '=', report_name)], limit=1)
|
||||||
"No report named '%s' found.") % report_name)
|
return res
|
||||||
return reports[0]
|
|
||||||
|
|
Loading…
Reference in New Issue