@@ -17,13 +17,13 @@ Base report csv
17
17
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18
18
:alt: License: AGPL-3
19
19
.. |badge3 | image :: https://img.shields.io/badge/github-OCA%2Freporting--engine-lightgray.png?logo=github
20
- :target: https://github.com/OCA/reporting-engine/tree/16 .0/report_csv
20
+ :target: https://github.com/OCA/reporting-engine/tree/17 .0/report_csv
21
21
:alt: OCA/reporting-engine
22
22
.. |badge4 | image :: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23
- :target: https://translation.odoo-community.org/projects/reporting-engine-16 -0/reporting-engine-16 -0-report_csv
23
+ :target: https://translation.odoo-community.org/projects/reporting-engine-17 -0/reporting-engine-17 -0-report_csv
24
24
:alt: Translate me on Weblate
25
25
.. |badge5 | image :: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26
- :target: https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&target_branch=16 .0
26
+ :target: https://runboat.odoo-community.org/builds?repo=OCA/reporting-engine&target_branch=17 .0
27
27
:alt: Try me on Runboat
28
28
29
29
|badge1 | |badge2 | |badge3 | |badge4 | |badge5 |
@@ -38,57 +38,65 @@ This module provides a basic report class to generate csv report.
38
38
Configuration
39
39
=============
40
40
41
- In case the exported CSV report should be encoded in another system than UTF-8, following
42
- fields of the report record (*Settings > Technical > Reports *) should be populated accordingly.
41
+ In case the exported CSV report should be encoded in another system than
42
+ UTF-8, following fields of the report record (*Settings > Technical >
43
+ Reports *) should be populated accordingly.
43
44
44
- * Encoding: set an encoding system (such as cp932)
45
- * Encode Error Handling: select 'Ignore' or 'Replace' as necessary.
45
+ - Encoding: set an encoding system (such as cp932)
46
+ - Encode Error Handling: select 'Ignore' or 'Replace' as necessary.
46
47
47
- * 'Ignore': in case of an encoding error, the problematic character will be removed from the exported file.
48
- * 'Replace': in case of an encoding error, the problematic character will be replaced with '?' symbol.
49
- * Leaving the field blank: in case of an encoding error, the report generation fails with an error message.
48
+ - 'Ignore': in case of an encoding error, the problematic character
49
+ will be removed from the exported file.
50
+ - 'Replace': in case of an encoding error, the problematic character
51
+ will be replaced with '?' symbol.
52
+ - Leaving the field blank: in case of an encoding error, the report
53
+ generation fails with an error message.
50
54
51
55
Usage
52
56
=====
53
57
54
- An example of CSV report for partners on a module called `module_name `:
58
+ An example of CSV report for partners on a module called
59
+ \` module_name\` :
55
60
56
- A python class ::
61
+ A python class :
57
62
58
- from odoo import models
63
+ ::
59
64
60
- class PartnerCSV(models.AbstractModel):
61
- _name = 'report.report_csv.partner_csv'
62
- _inherit = 'report.report_csv.abstract'
65
+ from odoo import models
63
66
64
- def generate_csv_report(self, writer, data, partners):
65
- writer.writeheader()
66
- for obj in partners:
67
- writer.writerow({
68
- 'name': obj.name,
69
- 'email': obj.email,
70
- })
67
+ class PartnerCSV(models.AbstractModel):
68
+ _name = 'report.report_csv.partner_csv'
69
+ _inherit = 'report.report_csv.abstract'
71
70
72
- def csv_report_options (self):
73
- res = super().csv_report_options ()
74
- res['fieldnames'].append('name')
75
- res['fieldnames'].append('email')
76
- res['delimiter'] = ';'
77
- res['quoting'] = csv.QUOTE_ALL
78
- return res
71
+ def generate_csv_report (self, writer, data, partners ):
72
+ writer.writeheader ()
73
+ for obj in partners:
74
+ writer.writerow({
75
+ 'name': obj.name,
76
+ 'email': obj.email,
77
+ })
79
78
79
+ def csv_report_options(self):
80
+ res = super().csv_report_options()
81
+ res['fieldnames'].append('name')
82
+ res['fieldnames'].append('email')
83
+ res['delimiter'] = ';'
84
+ res['quoting'] = csv.QUOTE_ALL
85
+ return res
80
86
81
- A report XML record ::
87
+ A report XML record :
82
88
83
- <report
84
- id="partner_csv"
85
- model="res.partner"
86
- string="Print to CSV"
87
- report_type="csv"
88
- name="module_name.report_name"
89
- file="res_partner"
90
- attachment_use="False"
91
- />
89
+ ::
90
+
91
+ <report
92
+ id="partner_csv"
93
+ model="res.partner"
94
+ string="Print to CSV"
95
+ report_type="csv"
96
+ name="module_name.report_name"
97
+ file="res_partner"
98
+ attachment_use="False"
99
+ />
92
100
93
101
Update encoding with an appropriate value (e.g. cp932) as necessary.
94
102
@@ -98,30 +106,30 @@ Bug Tracker
98
106
Bugs are tracked on `GitHub Issues <https://github.com/OCA/reporting-engine/issues >`_.
99
107
In case of trouble, please check there if your issue has already been reported.
100
108
If you spotted it first, help us to smash it by providing a detailed and welcomed
101
- `feedback <https://github.com/OCA/reporting-engine/issues/new?body=module:%20report_csv%0Aversion:%2016 .0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior** >`_.
109
+ `feedback <https://github.com/OCA/reporting-engine/issues/new?body=module:%20report_csv%0Aversion:%2017 .0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior** >`_.
102
110
103
111
Do not contact contributors directly about support or help with technical issues.
104
112
105
113
Credits
106
114
=======
107
115
108
116
Authors
109
- ~~~~~~~
117
+ -------
110
118
111
119
* Creu Blanca
112
120
113
121
Contributors
114
- ~~~~~~~~~~~~
122
+ ------------
115
123
116
- * Enric Tobella <etobella@creublanca.es>
117
- * Jaime Arroyo <jaime.arroyo@creublanca.es>
118
- * Rattapong Chokmasermkul <rattapongc@ecosoft.co.th>
119
- * `Quartile <https://www.quartile.co >`__:
124
+ - Enric Tobella <etobella@creublanca.es>
125
+ - Jaime Arroyo <jaime.arroyo@creublanca.es>
126
+ - Rattapong Chokmasermkul <rattapongc@ecosoft.co.th>
127
+ - `Quartile <https://www.quartile.co >`__:
120
128
121
- * Aung Ko Ko Lin
129
+ - Aung Ko Ko Lin
122
130
123
131
Maintainers
124
- ~~~~~~~~~~~
132
+ -----------
125
133
126
134
This module is maintained by the OCA.
127
135
@@ -133,6 +141,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
133
141
mission is to support the collaborative development of Odoo features and
134
142
promote its widespread use.
135
143
136
- This module is part of the `OCA/reporting-engine <https://github.com/OCA/reporting-engine/tree/16 .0/report_csv >`_ project on GitHub.
144
+ This module is part of the `OCA/reporting-engine <https://github.com/OCA/reporting-engine/tree/17 .0/report_csv >`_ project on GitHub.
137
145
138
146
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
0 commit comments