Search 1.4 billion lines of Odoo code on GitHub

report_csv

Author: Creu Blanca,Odoo Community Association (OCA)
License: AGPL-3
Branch: 11.0
Repository: 001101/reporting-engine
Dependencies: base, and web
Languages: JavaScript (43, 13.8%), Python (196, 63.0%), XML (20, 6.4%), and reStructuredText (52, 16.7%)
Other branches: 12.0, and 13.0
Other repositories: AITIC/reporting-engine, Aabcrow/reporting-engine, Alfa-90/reporting-engine, AsierSV/reporting-engine, CB-Gran-Canaria/reporting-engine, CGenie/reporting-engine, CMR-tetra/reporting-engine, Cayprol/reporting-engine, Change2improve/reporting-engine, ClancyQiao/reporting-engine, ComitorDevTeam/reporting-engine, DamonLiu0814/reporting-engine, Darknroses/reporting-engine, Digital5-Odoo/reporting-engine, ERPLibre/reporting-engine, Fitranugraha/reporting-engine, Gabinete-Digital/reporting-engine, Glue-Software-Engineering-AG/reporting-engine, HarshalBhoir/reporting-engine, HomerDeoDatu/reporting-engine, Infinityloopsistemas/reporting-engine, Ingeos/reporting-engine, Jarsa/reporting-engine, Jeisonpernia/reporting-engine, KonosCL/reporting-engine, LeGittan/reporting-engine, Leuan12/reporting-engine, Maartincm/reporting-engine, MathBenTech/reporting-engine, Mefistous/reporting-engine, NachoAlesLopez/reporting-engine, NeatNerdPrime/reporting-engine, NextERP-Romania/reporting-engine, Nubeo-be/reporting-engine, OCA-MUK/reporting-engine, OCA/reporting-engine, OpenCode/reporting-engine, Palpid/reporting-engine, QubiQ/reporting-engine, Rad0van/reporting-engine, RealSolutionsLux/reporting-engine, SanteLibre/reporting-engine, Saran440/reporting-engine, SequarSrl/reporting-engine, SerpentConsultingServices/reporting-engine, SeuMarco/reporting-engine, ShakirMemon786/reporting-engine, SimoRubi/reporting-engine, SolutionSeekers/reporting-engine, SportPursuit/reporting-engine, Studio73/reporting-engine, Syci-Consulting/reporting-engine, TRESCLOUD/reporting-engine, Tatider/reporting-engine, Tecnativa/reporting-engine, Tonow-c2c/reporting-engine, VanMoof/reporting-engine, WilldooIT/reporting-engine, Zio-Overload/reporting-engine, aaltinisik/reporting-engine, acsone/reporting-engine, adhoc-dev/oca-reporting-engine, ajaychauhan727/reporting-engine, ajinvn2019/reporting-engine, akretion/reporting-engine, akshayksolves/reporting-engine, alessavindell/reporting-engine, allanaguilar/reporting-engine, anhvu-sg/reporting-engine, augustynr/reporting-engine, aurestic/reporting-engine, bacgdev/reporting-engine, bacgroup/reporting-engine, brain-tec/reporting-engine, budisentosa/reporting-engine, camptocamp/reporting-engine, cataclysmic/reporting-engine, chenjingxiong/reporting-engine, coopiteasy/reporting-engine, dani-xtendoo/reporting-engine, diagramsoftware/reporting-engine, dominiquekonsuntack/reporting-engine, druidoo-dev/reporting-engine, dupski/reporting-engine, ecosoft-odoo/reporting-engine, eezee-it/reporting-engine, enocare/reporting-engine, etobella/reporting-engine, exosoftware/oca-reporting-engine, ezodoo/reporting-engine, fabiomix/reporting-engine, fateenvoy/reporting-engine, fauzi-tsani/reporting-engine, flachica/reporting-engine, fmdl/reporting-engine, fugui0310/reporting-engine, gbertolani/reporting-engine, govorushagreat/reporting-engine, goyugo/reporting-engine, henrycoding/reporting-engine, hippe-67/reporting-engine, hisyam44/reporting-engine, holgedchen/reporting-engine, ifadhf/reporting-engine, izzihector/reporting-engine, j209/reporting-engine, jacky82669513/reporting-engine, jaferrer/reporting-engine, jason156/reporting-engine, jffernandez/reporting-engine, jnaudon/reporting-engine, johnbendi/reporting-engine, kmee/reporting-engine, kongrattapong/reporting-engine, kos94ok-3D/reporting-engine, lbvisperas/reporting-engine, legalsylvain/reporting-engine, leonidasthe300/reporting-engine, lideritjnma/reporting-engine, lweiming/reporting-engine, maherjaballi/reporting-engine, max1314/reporting-engine, mohamed-helmy/reporting-engine, multidadosti-erp/reporting-engine, myceliandre/reporting-engine, myonnet/oca-reporting-engine, nabima/reporting-engine, nicolasjelincic/reporting-engine, niulinlnc/reporting-engine, nucleoosystem/reporting-engine, onesteinbv/reporting-engine, onurugur/reporting-engine, oondeo/reporting-engine, pasgou/reporting-engine, piensom/reporting-engine, praxigento/oca-reporting-engine, ps-tubtim/reporting-engine, pythoner-3k/reporting-engine, rachmataditiya/reporting-engine, robertsvx27/reporting-engine, robin5210/reporting-engine, royalline1/reporting-engine-1, rrgaona/reporting-engine, sacodoo/reporting-engine, sacostaylara/reporting-engine, samnimri/reporting-engine, sanube/reporting-engine, schout-it/reporting-engine, sendalpegat/reporting-engine, sewisoft/reporting-engine, sgheller/reporting-engine, solvosci/reporting-engine, somiderventa/reporting-engine, sunflowerit/reporting-engine, superkaja/reporting-engine, suwatuanp/reporting-engine, syci/reporting-engine, takinobori/oca-reporting-engine, tbaden/reporting-engine, tegin/reporting-engine, tirma-sa/reporting-engine, tsengel2/reporting-engine, unitek-solusi/OCA-reporting-engine, ursais/reporting-engine, valmarnet/reporting-engine, vdedyukhin/reporting-engine, versada/reporting-engine, vikichavada/reporting-engine, wahello/reporting-engine, xcgd/reporting-engine, xhair/reporting-engine, xwh123807/reporting-engine, and ygdmxy/reporting-engine

License: AGPL-3

Base report csv

This module provides a basic report class to generate csv report.

Usage

An example of CSV report for partners on a module called module_name:

A python class

from odoo import models

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.writerow({
                '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

<report
    id="partner_csv"
    model="res.partner"
    string="Print to CSV"
    report_type="csv"
    name="module_name.report_name"
    file="res_partner"
    attachment_use="False"
/>
Try me on Runbot

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed feedback.

Credits

Contributors

Maintainer

Odoo Community Association

This module is maintained by the OCA.

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

To contribute to this module, please visit https://odoo-community.org.