[IMP] report_csv : black, isort, prettier

pull/605/head
Adrien Peiffer 2022-04-05 10:26:08 +02:00
parent 45285ae082
commit 9137cf38cf
No known key found for this signature in database
GPG Key ID: D9266D898B218452
3 changed files with 7 additions and 7 deletions

View File

@ -6,7 +6,7 @@
"author": "Creu Blanca, Odoo Community Association (OCA)", "author": "Creu Blanca, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/reporting-engine", "website": "https://github.com/OCA/reporting-engine",
"category": "Reporting", "category": "Reporting",
"version": "14.0.1.0.0", "version": "15.0.1.0.0",
"license": "AGPL-3", "license": "AGPL-3",
"depends": ["base", "web"], "depends": ["base", "web"],
"data": ["views/webclient_templates.xml"], "data": ["views/webclient_templates.xml"],

View File

@ -27,7 +27,7 @@ class ReportController(report.ReportController):
if data["context"].get("lang"): if data["context"].get("lang"):
del data["context"]["lang"] del data["context"]["lang"]
context.update(data["context"]) context.update(data["context"])
csv = report.with_context(context)._render_csv(docids, data=data)[0] csv = report.with_context(**context)._render_csv(docids, data=data)[0]
filename = "{}.{}".format(report.name, "csv") filename = "{}.{}".format(report.name, "csv")
if docids: if docids:
obj = request.env[report.model].browse(docids) obj = request.env[report.model].browse(docids)

View File

@ -17,10 +17,10 @@ class ReportAction(models.Model):
report_model_name = "report.%s" % self.report_name report_model_name = "report.%s" % self.report_name
report_model = self.env.get(report_model_name) report_model = self.env.get(report_model_name)
if report_model is None: 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.with_context( return report_model.with_context(active_model=self.model).create_csv_report(
{"active_model": self.model} docids, data
).create_csv_report(docids, data) )
@api.model @api.model
def _get_report_from_name(self, report_name): def _get_report_from_name(self, report_name):
@ -34,4 +34,4 @@ class ReportAction(models.Model):
("report_name", "=", report_name), ("report_name", "=", report_name),
] ]
context = self.env["res.users"].context_get() context = self.env["res.users"].context_get()
return report_obj.with_context(context).search(conditions, limit=1) return report_obj.with_context(**context).search(conditions, limit=1)