mirror of
https://github.com/OCA/reporting-engine.git
synced 2025-02-16 16:30:38 +02:00
[MIG] report_csv: Migration to 16.0
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
# Copyright 2019 Creu Blanca
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import _, api, fields, models
|
||||
from odoo.exceptions import UserError
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class ReportAction(models.Model):
|
||||
@@ -13,14 +12,13 @@ class ReportAction(models.Model):
|
||||
)
|
||||
|
||||
@api.model
|
||||
def _render_csv(self, docids, data):
|
||||
report_model_name = "report.%s" % self.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)
|
||||
return report_model.with_context(active_model=self.model).create_csv_report(
|
||||
docids, data
|
||||
)
|
||||
def _render_csv(self, report_ref, docids, data):
|
||||
report_sudo = self._get_report(report_ref)
|
||||
report_model_name = "report.%s" % report_sudo.report_name
|
||||
report_model = self.env[report_model_name]
|
||||
return report_model.with_context(
|
||||
active_model=report_sudo.model
|
||||
).create_csv_report(docids, data)
|
||||
|
||||
@api.model
|
||||
def _get_report_from_name(self, report_name):
|
||||
|
||||
Reference in New Issue
Block a user