Browse Source

[IMP] report_csv: pass multi variable to be able to distingish which case you are in

pull/272/head
Lois Rilo 6 years ago
committed by Enric Tobella
parent
commit
fabb19c261
  1. 10
      report_csv/controllers/main.py

10
report_csv/controllers/main.py

@ -35,14 +35,16 @@ class ReportController(report.ReportController):
if docids: if docids:
obj = request.env[report.model].browse(docids) obj = request.env[report.model].browse(docids)
if report.print_report_name and not len(obj) > 1: if report.print_report_name and not len(obj) > 1:
report_name = safe_eval(report.print_report_name,
{'object': obj, 'time': time})
report_name = safe_eval(
report.print_report_name,
{'object': obj, 'time': time, 'multi': False})
filename = "%s.%s" % (report_name, "csv") filename = "%s.%s" % (report_name, "csv")
# When we print multiple records we still allow a custom # When we print multiple records we still allow a custom
# filename. # filename.
elif report.print_report_name and len(obj) > 1: elif report.print_report_name and len(obj) > 1:
report_name = safe_eval(report.print_report_name,
{'objects': obj, 'time': time})
report_name = safe_eval(
report.print_report_name,
{'objects': obj, 'time': time, 'multi': True})
filename = "%s.%s" % (report_name, "csv") filename = "%s.%s" % (report_name, "csv")
csvhttpheaders = [ csvhttpheaders = [
('Content-Type', 'text/csv'), ('Content-Type', 'text/csv'),

Loading…
Cancel
Save