From 912a0ee13099986d1ba15829672e8d3530cb3a34 Mon Sep 17 00:00:00 2001 From: Jordi Ballester Alomar Date: Tue, 5 Feb 2019 17:36:12 +0100 Subject: [PATCH] [IMP] report_csv: use dialects --- report_csv/README.rst | 15 ++++++++++----- report_csv/report/report_csv.py | 6 ++++++ report_csv/report/report_partner_csv.py | 10 +++++++--- report_csv/tests/test_report.py | 3 ++- 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/report_csv/README.rst b/report_csv/README.rst index a4c2aa98..bec910f9 100644 --- a/report_csv/README.rst +++ b/report_csv/README.rst @@ -18,22 +18,27 @@ A python class :: from odoo import models - class PartnerCsv(models.AbstractModel): - _name = 'report.module_name.report_name' + class PartnerCSV(models.AbstractModel): + _name = 'report.report_csv.partner_csv' _inherit = 'report.report_csv.abstract' - + def generate_csv_report(self, writer, data, partners): + writer.writeheader() for obj in partners: - writer.writeheader() writer.writerow({ - 'name': obj.name + 'name': obj.name, + 'email': obj.email, }) def csv_report_options(self): res = super().csv_report_options() res['fieldnames'].append('name') + res['fieldnames'].append('email') + res['delimiter'] = ';' + res['quoting'] = csv.QUOTE_ALL return res + A report XML record ::