odoo-addon-base-report-auto-create-qweb 16.0.1.0.0.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. odoo/addons/base_report_auto_create_qweb/README.rst +95 -0
  2. odoo/addons/base_report_auto_create_qweb/__init__.py +2 -0
  3. odoo/addons/base_report_auto_create_qweb/__manifest__.py +26 -0
  4. odoo/addons/base_report_auto_create_qweb/i18n/am.po +120 -0
  5. odoo/addons/base_report_auto_create_qweb/i18n/ar.po +121 -0
  6. odoo/addons/base_report_auto_create_qweb/i18n/base_report_auto_create_qweb.pot +113 -0
  7. odoo/addons/base_report_auto_create_qweb/i18n/bg.po +120 -0
  8. odoo/addons/base_report_auto_create_qweb/i18n/bs.po +121 -0
  9. odoo/addons/base_report_auto_create_qweb/i18n/ca.po +120 -0
  10. odoo/addons/base_report_auto_create_qweb/i18n/ca_ES.po +120 -0
  11. odoo/addons/base_report_auto_create_qweb/i18n/cs.po +120 -0
  12. odoo/addons/base_report_auto_create_qweb/i18n/da.po +120 -0
  13. odoo/addons/base_report_auto_create_qweb/i18n/de.po +129 -0
  14. odoo/addons/base_report_auto_create_qweb/i18n/el_GR.po +121 -0
  15. odoo/addons/base_report_auto_create_qweb/i18n/en_AU.po +121 -0
  16. odoo/addons/base_report_auto_create_qweb/i18n/en_GB.po +120 -0
  17. odoo/addons/base_report_auto_create_qweb/i18n/es.po +124 -0
  18. odoo/addons/base_report_auto_create_qweb/i18n/es_AR.po +121 -0
  19. odoo/addons/base_report_auto_create_qweb/i18n/es_CL.po +121 -0
  20. odoo/addons/base_report_auto_create_qweb/i18n/es_CO.po +120 -0
  21. odoo/addons/base_report_auto_create_qweb/i18n/es_CR.po +121 -0
  22. odoo/addons/base_report_auto_create_qweb/i18n/es_DO.po +121 -0
  23. odoo/addons/base_report_auto_create_qweb/i18n/es_EC.po +120 -0
  24. odoo/addons/base_report_auto_create_qweb/i18n/es_ES.po +120 -0
  25. odoo/addons/base_report_auto_create_qweb/i18n/es_MX.po +121 -0
  26. odoo/addons/base_report_auto_create_qweb/i18n/es_PE.po +121 -0
  27. odoo/addons/base_report_auto_create_qweb/i18n/es_PY.po +120 -0
  28. odoo/addons/base_report_auto_create_qweb/i18n/es_VE.po +120 -0
  29. odoo/addons/base_report_auto_create_qweb/i18n/et.po +120 -0
  30. odoo/addons/base_report_auto_create_qweb/i18n/eu.po +120 -0
  31. odoo/addons/base_report_auto_create_qweb/i18n/fa.po +120 -0
  32. odoo/addons/base_report_auto_create_qweb/i18n/fi.po +120 -0
  33. odoo/addons/base_report_auto_create_qweb/i18n/fr.po +120 -0
  34. odoo/addons/base_report_auto_create_qweb/i18n/fr_CA.po +121 -0
  35. odoo/addons/base_report_auto_create_qweb/i18n/fr_CH.po +121 -0
  36. odoo/addons/base_report_auto_create_qweb/i18n/fr_FR.po +120 -0
  37. odoo/addons/base_report_auto_create_qweb/i18n/gl.po +120 -0
  38. odoo/addons/base_report_auto_create_qweb/i18n/gl_ES.po +120 -0
  39. odoo/addons/base_report_auto_create_qweb/i18n/he.po +120 -0
  40. odoo/addons/base_report_auto_create_qweb/i18n/hi.po +120 -0
  41. odoo/addons/base_report_auto_create_qweb/i18n/hr.po +128 -0
  42. odoo/addons/base_report_auto_create_qweb/i18n/hr_HR.po +122 -0
  43. odoo/addons/base_report_auto_create_qweb/i18n/hu.po +120 -0
  44. odoo/addons/base_report_auto_create_qweb/i18n/id.po +120 -0
  45. odoo/addons/base_report_auto_create_qweb/i18n/it.po +122 -0
  46. odoo/addons/base_report_auto_create_qweb/i18n/ja.po +120 -0
  47. odoo/addons/base_report_auto_create_qweb/i18n/ko.po +120 -0
  48. odoo/addons/base_report_auto_create_qweb/i18n/lo.po +120 -0
  49. odoo/addons/base_report_auto_create_qweb/i18n/lt.po +121 -0
  50. odoo/addons/base_report_auto_create_qweb/i18n/lt_LT.po +122 -0
  51. odoo/addons/base_report_auto_create_qweb/i18n/lv.po +121 -0
  52. odoo/addons/base_report_auto_create_qweb/i18n/mk.po +120 -0
  53. odoo/addons/base_report_auto_create_qweb/i18n/mn.po +120 -0
  54. odoo/addons/base_report_auto_create_qweb/i18n/nb.po +120 -0
  55. odoo/addons/base_report_auto_create_qweb/i18n/nb_NO.po +120 -0
  56. odoo/addons/base_report_auto_create_qweb/i18n/nl.po +120 -0
  57. odoo/addons/base_report_auto_create_qweb/i18n/nl_BE.po +121 -0
  58. odoo/addons/base_report_auto_create_qweb/i18n/nl_NL.po +121 -0
  59. odoo/addons/base_report_auto_create_qweb/i18n/pl.po +121 -0
  60. odoo/addons/base_report_auto_create_qweb/i18n/pt.po +120 -0
  61. odoo/addons/base_report_auto_create_qweb/i18n/pt_BR.po +121 -0
  62. odoo/addons/base_report_auto_create_qweb/i18n/pt_PT.po +121 -0
  63. odoo/addons/base_report_auto_create_qweb/i18n/ro.po +121 -0
  64. odoo/addons/base_report_auto_create_qweb/i18n/ru.po +122 -0
  65. odoo/addons/base_report_auto_create_qweb/i18n/sk.po +120 -0
  66. odoo/addons/base_report_auto_create_qweb/i18n/sl.po +122 -0
  67. odoo/addons/base_report_auto_create_qweb/i18n/sr.po +121 -0
  68. odoo/addons/base_report_auto_create_qweb/i18n/sr@latin.po +122 -0
  69. odoo/addons/base_report_auto_create_qweb/i18n/sv.po +120 -0
  70. odoo/addons/base_report_auto_create_qweb/i18n/th.po +120 -0
  71. odoo/addons/base_report_auto_create_qweb/i18n/tr.po +120 -0
  72. odoo/addons/base_report_auto_create_qweb/i18n/tr_TR.po +121 -0
  73. odoo/addons/base_report_auto_create_qweb/i18n/uk.po +121 -0
  74. odoo/addons/base_report_auto_create_qweb/i18n/vi.po +120 -0
  75. odoo/addons/base_report_auto_create_qweb/i18n/vi_VN.po +121 -0
  76. odoo/addons/base_report_auto_create_qweb/i18n/zh_CN.po +121 -0
  77. odoo/addons/base_report_auto_create_qweb/i18n/zh_TW.po +121 -0
  78. odoo/addons/base_report_auto_create_qweb/models/__init__.py +1 -0
  79. odoo/addons/base_report_auto_create_qweb/models/report_xml.py +101 -0
  80. odoo/addons/base_report_auto_create_qweb/readme/CONTRIBUTORS.rst +5 -0
  81. odoo/addons/base_report_auto_create_qweb/readme/DESCRIPTION.rst +11 -0
  82. odoo/addons/base_report_auto_create_qweb/security/ir.model.access.csv +2 -0
  83. odoo/addons/base_report_auto_create_qweb/static/description/icon.png +0 -0
  84. odoo/addons/base_report_auto_create_qweb/static/description/index.html +442 -0
  85. odoo/addons/base_report_auto_create_qweb/tests/__init__.py +4 -0
  86. odoo/addons/base_report_auto_create_qweb/tests/test_base_report_auto_create_qweb.py +84 -0
  87. odoo/addons/base_report_auto_create_qweb/views/report_xml_view.xml +29 -0
  88. odoo/addons/base_report_auto_create_qweb/wizard/__init__.py +1 -0
  89. odoo/addons/base_report_auto_create_qweb/wizard/report_duplicate.py +21 -0
  90. odoo/addons/base_report_auto_create_qweb/wizard/report_duplicate_view.xml +36 -0
  91. odoo_addon_base_report_auto_create_qweb-16.0.1.0.0.2.dist-info/METADATA +111 -0
  92. odoo_addon_base_report_auto_create_qweb-16.0.1.0.0.2.dist-info/RECORD +94 -0
  93. odoo_addon_base_report_auto_create_qweb-16.0.1.0.0.2.dist-info/WHEEL +5 -0
  94. odoo_addon_base_report_auto_create_qweb-16.0.1.0.0.2.dist-info/top_level.txt +1 -0
@@ -0,0 +1,101 @@
1
+ # Authors: See README.RST for Contributors
2
+ # Copyright 2015-2017
3
+ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
4
+
5
+ from unidecode import unidecode
6
+
7
+ from odoo import _, api, exceptions, models
8
+
9
+
10
+ class IrActionsReport(models.Model):
11
+ _inherit = "ir.actions.report"
12
+
13
+ def _format_template_name(self, text):
14
+ text = unidecode(text)
15
+ text.lower()
16
+ return text
17
+
18
+ def _prepare_qweb_view_data(self, qweb_name, arch):
19
+ return {
20
+ "name": qweb_name,
21
+ "mode": "primary",
22
+ "type": "qweb",
23
+ "arch": arch,
24
+ }
25
+
26
+ def _prepare_model_data_data(self, qweb_name, module, qweb_view):
27
+ return {
28
+ "module": module,
29
+ "name": qweb_name,
30
+ "res_id": qweb_view.id,
31
+ "model": "ir.ui.view",
32
+ }
33
+
34
+ def _create_qweb(self, name, qweb_name, module, model, arch):
35
+ qweb_view_data = self._prepare_qweb_view_data(qweb_name, arch)
36
+ qweb_view = self.env["ir.ui.view"].create(qweb_view_data)
37
+ model_data_data = self._prepare_model_data_data(qweb_name, module, qweb_view)
38
+ self.env["ir.model.data"].create(model_data_data)
39
+
40
+ @api.model
41
+ def create(self, values):
42
+ values["report_name"] = self._format_template_name(
43
+ values.get("report_name", "")
44
+ )
45
+ if (
46
+ values.get("report_type") in ["qweb-pdf", "qweb-html"]
47
+ and values.get("report_name")
48
+ and values["report_name"].find(".") == -1
49
+ ):
50
+ raise exceptions.UserError(
51
+ _("Template Name must contain at least a dot in it's name")
52
+ )
53
+ if not self.env.context.get("enable_duplication", False):
54
+ return super(IrActionsReport, self).create(values)
55
+ report_xml = super(IrActionsReport, self).create(values)
56
+ if values.get("report_type") in ["qweb-pdf", "qweb-html"]:
57
+ report_view_ids = self.env.context.get("report_views", False)
58
+ suffix = self.env.context.get("suffix") or "copy"
59
+ name = values["name"]
60
+ model = values["model"]
61
+ report = values["report_name"]
62
+ module = report.split(".")[0]
63
+ report_name = report.split(".")[1]
64
+ for report_view in self.env["ir.ui.view"].browse(report_view_ids):
65
+ origin_name = report_name.replace(("_%s" % suffix), "")
66
+ origin_module = module.replace(("_%s" % suffix), "")
67
+ new_report_name = "{}_{}".format(origin_name, suffix)
68
+ qweb_name = report_view.name.replace(origin_name, new_report_name)
69
+ arch = report_view.arch.replace(origin_name, new_report_name).replace(
70
+ origin_module + ".", module + "."
71
+ )
72
+ report_xml._create_qweb(name, qweb_name, module, model, arch)
73
+ if not report_view_ids:
74
+ arch = '<?xml version="1.0"?>\n' '<t t-name="%s">\n</t>' % report_name
75
+ report_xml._create_qweb(name, report_name, module, model, arch)
76
+ return report_xml
77
+
78
+ def copy(self, default=None):
79
+ if not self.env.context.get("enable_duplication", False):
80
+ return super(IrActionsReport, self).copy(default=default)
81
+ if default is None:
82
+ default = {}
83
+ suffix = self.env.context.get("suffix") or "copy"
84
+ default["name"] = "{} ({})".format(self.name, suffix)
85
+ module = "{}_{}".format(self.report_name.split(".")[0], suffix.lower())
86
+ report = "{}_{}".format(self.report_name.split(".")[1], suffix.lower())
87
+ default["report_name"] = "{}.{}".format(module, report)
88
+ report_views_domain = self.associated_view()["domain"]
89
+ report_views = self.env["ir.ui.view"].search(report_views_domain)
90
+ return super(
91
+ IrActionsReport,
92
+ self.with_context(report_views=report_views.ids, suffix=suffix.lower()),
93
+ ).copy(default=default)
94
+
95
+ def button_create_qweb(self):
96
+ self.ensure_one()
97
+ module = self.report_name.split(".")[0]
98
+ report_name = self.report_name.split(".")[1]
99
+ arch = '<?xml version="1.0"?>\n' '<t t-name="%s">\n</t>' % self.report_name
100
+ self._create_qweb(self.name, report_name, module, self.model, arch)
101
+ self.associated_view()
@@ -0,0 +1,5 @@
1
+ * Oihane Crucelaegui <oihanecrucelaegi@avanzosc.es>
2
+ * Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
3
+ * Ana Juaristi <anajuaristi@avanzosc.es>
4
+ * Alex Comba <alex.comba@agilebg.com>
5
+ * Akim Juillerat <akim.juillerat@camptocamp.com>
@@ -0,0 +1,11 @@
1
+ When creating a report in Settings > Technical > Actions > Reports or
2
+ Settings > Technical > Reports > Reports it will create an empty Qweb template
3
+ and the required linking info so that the user does not need to know how to do
4
+ all the links.
5
+
6
+ New duplication button added, it enables the possibility of duplicating a report
7
+ and assigning to the duplicated one a suffix. If the copy option provided by the
8
+ system is used this will add 'copy' as suffix.
9
+
10
+ Be careful with this option as it can create many unnecessary Qweb views because
11
+ it duplicates all the related files to the report you are copying.
@@ -0,0 +1,2 @@
1
+ id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
2
+ access_ir_actions_report_duplicate,Access rule for Duplicate Qweb report,model_ir_actions_report_duplicate,base.group_user,1,1,1,1
@@ -0,0 +1,442 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
6
+ <title>README.rst</title>
7
+ <style type="text/css">
8
+
9
+ /*
10
+ :Author: David Goodger (goodger@python.org)
11
+ :Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
12
+ :Copyright: This stylesheet has been placed in the public domain.
13
+
14
+ Default cascading style sheet for the HTML output of Docutils.
15
+ Despite the name, some widely supported CSS2 features are used.
16
+
17
+ See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
18
+ customize this style sheet.
19
+ */
20
+
21
+ /* used to remove borders from tables and images */
22
+ .borderless, table.borderless td, table.borderless th {
23
+ border: 0 }
24
+
25
+ table.borderless td, table.borderless th {
26
+ /* Override padding for "table.docutils td" with "! important".
27
+ The right padding separates the table cells. */
28
+ padding: 0 0.5em 0 0 ! important }
29
+
30
+ .first {
31
+ /* Override more specific margin styles with "! important". */
32
+ margin-top: 0 ! important }
33
+
34
+ .last, .with-subtitle {
35
+ margin-bottom: 0 ! important }
36
+
37
+ .hidden {
38
+ display: none }
39
+
40
+ .subscript {
41
+ vertical-align: sub;
42
+ font-size: smaller }
43
+
44
+ .superscript {
45
+ vertical-align: super;
46
+ font-size: smaller }
47
+
48
+ a.toc-backref {
49
+ text-decoration: none ;
50
+ color: black }
51
+
52
+ blockquote.epigraph {
53
+ margin: 2em 5em ; }
54
+
55
+ dl.docutils dd {
56
+ margin-bottom: 0.5em }
57
+
58
+ object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
59
+ overflow: hidden;
60
+ }
61
+
62
+ /* Uncomment (and remove this text!) to get bold-faced definition list terms
63
+ dl.docutils dt {
64
+ font-weight: bold }
65
+ */
66
+
67
+ div.abstract {
68
+ margin: 2em 5em }
69
+
70
+ div.abstract p.topic-title {
71
+ font-weight: bold ;
72
+ text-align: center }
73
+
74
+ div.admonition, div.attention, div.caution, div.danger, div.error,
75
+ div.hint, div.important, div.note, div.tip, div.warning {
76
+ margin: 2em ;
77
+ border: medium outset ;
78
+ padding: 1em }
79
+
80
+ div.admonition p.admonition-title, div.hint p.admonition-title,
81
+ div.important p.admonition-title, div.note p.admonition-title,
82
+ div.tip p.admonition-title {
83
+ font-weight: bold ;
84
+ font-family: sans-serif }
85
+
86
+ div.attention p.admonition-title, div.caution p.admonition-title,
87
+ div.danger p.admonition-title, div.error p.admonition-title,
88
+ div.warning p.admonition-title, .code .error {
89
+ color: red ;
90
+ font-weight: bold ;
91
+ font-family: sans-serif }
92
+
93
+ /* Uncomment (and remove this text!) to get reduced vertical space in
94
+ compound paragraphs.
95
+ div.compound .compound-first, div.compound .compound-middle {
96
+ margin-bottom: 0.5em }
97
+
98
+ div.compound .compound-last, div.compound .compound-middle {
99
+ margin-top: 0.5em }
100
+ */
101
+
102
+ div.dedication {
103
+ margin: 2em 5em ;
104
+ text-align: center ;
105
+ font-style: italic }
106
+
107
+ div.dedication p.topic-title {
108
+ font-weight: bold ;
109
+ font-style: normal }
110
+
111
+ div.figure {
112
+ margin-left: 2em ;
113
+ margin-right: 2em }
114
+
115
+ div.footer, div.header {
116
+ clear: both;
117
+ font-size: smaller }
118
+
119
+ div.line-block {
120
+ display: block ;
121
+ margin-top: 1em ;
122
+ margin-bottom: 1em }
123
+
124
+ div.line-block div.line-block {
125
+ margin-top: 0 ;
126
+ margin-bottom: 0 ;
127
+ margin-left: 1.5em }
128
+
129
+ div.sidebar {
130
+ margin: 0 0 0.5em 1em ;
131
+ border: medium outset ;
132
+ padding: 1em ;
133
+ background-color: #ffffee ;
134
+ width: 40% ;
135
+ float: right ;
136
+ clear: right }
137
+
138
+ div.sidebar p.rubric {
139
+ font-family: sans-serif ;
140
+ font-size: medium }
141
+
142
+ div.system-messages {
143
+ margin: 5em }
144
+
145
+ div.system-messages h1 {
146
+ color: red }
147
+
148
+ div.system-message {
149
+ border: medium outset ;
150
+ padding: 1em }
151
+
152
+ div.system-message p.system-message-title {
153
+ color: red ;
154
+ font-weight: bold }
155
+
156
+ div.topic {
157
+ margin: 2em }
158
+
159
+ h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
160
+ h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
161
+ margin-top: 0.4em }
162
+
163
+ h1.title {
164
+ text-align: center }
165
+
166
+ h2.subtitle {
167
+ text-align: center }
168
+
169
+ hr.docutils {
170
+ width: 75% }
171
+
172
+ img.align-left, .figure.align-left, object.align-left, table.align-left {
173
+ clear: left ;
174
+ float: left ;
175
+ margin-right: 1em }
176
+
177
+ img.align-right, .figure.align-right, object.align-right, table.align-right {
178
+ clear: right ;
179
+ float: right ;
180
+ margin-left: 1em }
181
+
182
+ img.align-center, .figure.align-center, object.align-center {
183
+ display: block;
184
+ margin-left: auto;
185
+ margin-right: auto;
186
+ }
187
+
188
+ table.align-center {
189
+ margin-left: auto;
190
+ margin-right: auto;
191
+ }
192
+
193
+ .align-left {
194
+ text-align: left }
195
+
196
+ .align-center {
197
+ clear: both ;
198
+ text-align: center }
199
+
200
+ .align-right {
201
+ text-align: right }
202
+
203
+ /* reset inner alignment in figures */
204
+ div.align-right {
205
+ text-align: inherit }
206
+
207
+ /* div.align-center * { */
208
+ /* text-align: left } */
209
+
210
+ .align-top {
211
+ vertical-align: top }
212
+
213
+ .align-middle {
214
+ vertical-align: middle }
215
+
216
+ .align-bottom {
217
+ vertical-align: bottom }
218
+
219
+ ol.simple, ul.simple {
220
+ margin-bottom: 1em }
221
+
222
+ ol.arabic {
223
+ list-style: decimal }
224
+
225
+ ol.loweralpha {
226
+ list-style: lower-alpha }
227
+
228
+ ol.upperalpha {
229
+ list-style: upper-alpha }
230
+
231
+ ol.lowerroman {
232
+ list-style: lower-roman }
233
+
234
+ ol.upperroman {
235
+ list-style: upper-roman }
236
+
237
+ p.attribution {
238
+ text-align: right ;
239
+ margin-left: 50% }
240
+
241
+ p.caption {
242
+ font-style: italic }
243
+
244
+ p.credits {
245
+ font-style: italic ;
246
+ font-size: smaller }
247
+
248
+ p.label {
249
+ white-space: nowrap }
250
+
251
+ p.rubric {
252
+ font-weight: bold ;
253
+ font-size: larger ;
254
+ color: maroon ;
255
+ text-align: center }
256
+
257
+ p.sidebar-title {
258
+ font-family: sans-serif ;
259
+ font-weight: bold ;
260
+ font-size: larger }
261
+
262
+ p.sidebar-subtitle {
263
+ font-family: sans-serif ;
264
+ font-weight: bold }
265
+
266
+ p.topic-title {
267
+ font-weight: bold }
268
+
269
+ pre.address {
270
+ margin-bottom: 0 ;
271
+ margin-top: 0 ;
272
+ font: inherit }
273
+
274
+ pre.literal-block, pre.doctest-block, pre.math, pre.code {
275
+ margin-left: 2em ;
276
+ margin-right: 2em }
277
+
278
+ pre.code .ln { color: gray; } /* line numbers */
279
+ pre.code, code { background-color: #eeeeee }
280
+ pre.code .comment, code .comment { color: #5C6576 }
281
+ pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
282
+ pre.code .literal.string, code .literal.string { color: #0C5404 }
283
+ pre.code .name.builtin, code .name.builtin { color: #352B84 }
284
+ pre.code .deleted, code .deleted { background-color: #DEB0A1}
285
+ pre.code .inserted, code .inserted { background-color: #A3D289}
286
+
287
+ span.classifier {
288
+ font-family: sans-serif ;
289
+ font-style: oblique }
290
+
291
+ span.classifier-delimiter {
292
+ font-family: sans-serif ;
293
+ font-weight: bold }
294
+
295
+ span.interpreted {
296
+ font-family: sans-serif }
297
+
298
+ span.option {
299
+ white-space: nowrap }
300
+
301
+ span.pre {
302
+ white-space: pre }
303
+
304
+ span.problematic, pre.problematic {
305
+ color: red }
306
+
307
+ span.section-subtitle {
308
+ /* font-size relative to parent (h1..h6 element) */
309
+ font-size: 80% }
310
+
311
+ table.citation {
312
+ border-left: solid 1px gray;
313
+ margin-left: 1px }
314
+
315
+ table.docinfo {
316
+ margin: 2em 4em }
317
+
318
+ table.docutils {
319
+ margin-top: 0.5em ;
320
+ margin-bottom: 0.5em }
321
+
322
+ table.footnote {
323
+ border-left: solid 1px black;
324
+ margin-left: 1px }
325
+
326
+ table.docutils td, table.docutils th,
327
+ table.docinfo td, table.docinfo th {
328
+ padding-left: 0.5em ;
329
+ padding-right: 0.5em ;
330
+ vertical-align: top }
331
+
332
+ table.docutils th.field-name, table.docinfo th.docinfo-name {
333
+ font-weight: bold ;
334
+ text-align: left ;
335
+ white-space: nowrap ;
336
+ padding-left: 0 }
337
+
338
+ /* "booktabs" style (no vertical lines) */
339
+ table.docutils.booktabs {
340
+ border: 0px;
341
+ border-top: 2px solid;
342
+ border-bottom: 2px solid;
343
+ border-collapse: collapse;
344
+ }
345
+ table.docutils.booktabs * {
346
+ border: 0px;
347
+ }
348
+ table.docutils.booktabs th {
349
+ border-bottom: thin solid;
350
+ text-align: left;
351
+ }
352
+
353
+ h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
354
+ h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
355
+ font-size: 100% }
356
+
357
+ ul.auto-toc {
358
+ list-style-type: none }
359
+
360
+ </style>
361
+ </head>
362
+ <body>
363
+ <div class="document">
364
+
365
+
366
+ <a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
367
+ <img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
368
+ </a>
369
+ <div class="section" id="report-qweb-auto-generation">
370
+ <h1>Report qweb auto generation</h1>
371
+ <!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
372
+ !! This file is generated by oca-gen-addon-readme !!
373
+ !! changes will be overwritten. !!
374
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
375
+ !! source digest: sha256:89f07525eef2571355e6a644255da53ab48a9c28435eb13aa19694728779b864
376
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
377
+ <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-tools/tree/16.0/base_report_auto_create_qweb"><img alt="OCA/server-tools" src="https://img.shields.io/badge/github-OCA%2Fserver--tools-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-base_report_auto_create_qweb"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-tools&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
378
+ <p>When creating a report in Settings &gt; Technical &gt; Actions &gt; Reports or
379
+ Settings &gt; Technical &gt; Reports &gt; Reports it will create an empty Qweb template
380
+ and the required linking info so that the user does not need to know how to do
381
+ all the links.</p>
382
+ <p>New duplication button added, it enables the possibility of duplicating a report
383
+ and assigning to the duplicated one a suffix. If the copy option provided by the
384
+ system is used this will add ‘copy’ as suffix.</p>
385
+ <p>Be careful with this option as it can create many unnecessary Qweb views because
386
+ it duplicates all the related files to the report you are copying.</p>
387
+ <p><strong>Table of contents</strong></p>
388
+ <div class="contents local topic" id="contents">
389
+ <ul class="simple">
390
+ <li><a class="reference internal" href="#bug-tracker" id="toc-entry-1">Bug Tracker</a></li>
391
+ <li><a class="reference internal" href="#credits" id="toc-entry-2">Credits</a><ul>
392
+ <li><a class="reference internal" href="#authors" id="toc-entry-3">Authors</a></li>
393
+ <li><a class="reference internal" href="#contributors" id="toc-entry-4">Contributors</a></li>
394
+ <li><a class="reference internal" href="#maintainers" id="toc-entry-5">Maintainers</a></li>
395
+ </ul>
396
+ </li>
397
+ </ul>
398
+ </div>
399
+ <div class="section" id="bug-tracker">
400
+ <h2><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h2>
401
+ <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-tools/issues">GitHub Issues</a>.
402
+ In case of trouble, please check there if your issue has already been reported.
403
+ If you spotted it first, help us to smash it by providing a detailed and welcomed
404
+ <a class="reference external" href="https://github.com/OCA/server-tools/issues/new?body=module:%20base_report_auto_create_qweb%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
405
+ <p>Do not contact contributors directly about support or help with technical issues.</p>
406
+ </div>
407
+ <div class="section" id="credits">
408
+ <h2><a class="toc-backref" href="#toc-entry-2">Credits</a></h2>
409
+ <div class="section" id="authors">
410
+ <h3><a class="toc-backref" href="#toc-entry-3">Authors</a></h3>
411
+ <ul class="simple">
412
+ <li>AvanzOSC</li>
413
+ <li>Tecnativa</li>
414
+ </ul>
415
+ </div>
416
+ <div class="section" id="contributors">
417
+ <h3><a class="toc-backref" href="#toc-entry-4">Contributors</a></h3>
418
+ <ul class="simple">
419
+ <li>Oihane Crucelaegui &lt;<a class="reference external" href="mailto:oihanecrucelaegi&#64;avanzosc.es">oihanecrucelaegi&#64;avanzosc.es</a>&gt;</li>
420
+ <li>Pedro M. Baeza &lt;<a class="reference external" href="mailto:pedro.baeza&#64;serviciosbaeza.com">pedro.baeza&#64;serviciosbaeza.com</a>&gt;</li>
421
+ <li>Ana Juaristi &lt;<a class="reference external" href="mailto:anajuaristi&#64;avanzosc.es">anajuaristi&#64;avanzosc.es</a>&gt;</li>
422
+ <li>Alex Comba &lt;<a class="reference external" href="mailto:alex.comba&#64;agilebg.com">alex.comba&#64;agilebg.com</a>&gt;</li>
423
+ <li>Akim Juillerat &lt;<a class="reference external" href="mailto:akim.juillerat&#64;camptocamp.com">akim.juillerat&#64;camptocamp.com</a>&gt;</li>
424
+ </ul>
425
+ </div>
426
+ <div class="section" id="maintainers">
427
+ <h3><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h3>
428
+ <p>This module is maintained by the OCA.</p>
429
+ <a class="reference external image-reference" href="https://odoo-community.org">
430
+ <img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
431
+ </a>
432
+ <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
433
+ mission is to support the collaborative development of Odoo features and
434
+ promote its widespread use.</p>
435
+ <p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-tools/tree/16.0/base_report_auto_create_qweb">OCA/server-tools</a> project on GitHub.</p>
436
+ <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
437
+ </div>
438
+ </div>
439
+ </div>
440
+ </div>
441
+ </body>
442
+ </html>
@@ -0,0 +1,4 @@
1
+ # (c) 2015 Oihane Crucelaegui - AvanzOSC
2
+ # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
3
+
4
+ from . import test_base_report_auto_create_qweb
@@ -0,0 +1,84 @@
1
+ # Copyright 2015-2017
2
+ # License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
3
+
4
+ import odoo.tests.common as common
5
+ from odoo import exceptions
6
+
7
+
8
+ class TestBaseReportAutoQwebCreate(common.TransactionCase):
9
+ def setUp(self):
10
+ super(TestBaseReportAutoQwebCreate, self).setUp()
11
+ self.report_model = self.env["ir.actions.report"]
12
+ self.duplicate_model = self.env["ir.actions.report.duplicate"]
13
+ self.view_model = self.env["ir.ui.view"]
14
+
15
+ def test_creation_html(self):
16
+ report_html = self.report_model.create(
17
+ {
18
+ "name": "Test 1",
19
+ "model": "res.partner",
20
+ "report_type": "qweb-html",
21
+ "report_name": "test1.auto_qweb_report_test",
22
+ }
23
+ )
24
+ report_html.button_create_qweb()
25
+ view_num = self.view_model.search_count(
26
+ [
27
+ ("name", "ilike", report_html.report_name.split(".")[1]),
28
+ ("type", "=", "qweb"),
29
+ ]
30
+ )
31
+ self.assertNotEqual(view_num, 0, "There are not related views")
32
+ self.assertEqual(view_num, 1, "Only one view must be created.")
33
+
34
+ def test_creation_duplicate_pdf(self):
35
+ report_pdf = self.report_model.create(
36
+ {
37
+ "name": "Test 2",
38
+ "model": "res.partner",
39
+ "report_type": "qweb-pdf",
40
+ "report_name": "test2.auto_qweb_report_test",
41
+ }
42
+ )
43
+ report_pdf.button_create_qweb()
44
+ view_num = self.view_model.search_count(
45
+ [
46
+ ("name", "ilike", report_pdf.report_name.split(".")[1]),
47
+ ("type", "=", "qweb"),
48
+ ]
49
+ )
50
+ self.assertNotEqual(view_num, 0, "There are not related views.")
51
+ self.assertEqual(view_num, 1, "One view must be created.")
52
+ wizard = self.duplicate_model.with_context(
53
+ active_id=report_pdf.id, model=report_pdf.model
54
+ ).create(
55
+ {
56
+ "suffix": "copytest",
57
+ }
58
+ )
59
+ wizard.duplicate_report()
60
+ report_pdf_copies = self.report_model.search(
61
+ [("report_name", "ilike", "test2_copytest.report_test_copytest")]
62
+ )
63
+ for report_pdf_copy in report_pdf_copies:
64
+ view_num2 = self.view_model.search_count(
65
+ [
66
+ ("name", "ilike", report_pdf_copy.report_name.split(".")[1]),
67
+ ("type", "=", "qweb"),
68
+ ]
69
+ )
70
+ self.assertNotEqual(view_num2, 0, "There are not related views.")
71
+ self.assertEqual(
72
+ view_num2, view_num, "Same view numbers must have been created."
73
+ )
74
+
75
+ def test_wrong_template_name(self):
76
+ with self.assertRaises(exceptions.UserError):
77
+ self.report_model.create(
78
+ {
79
+ "name": "Test",
80
+ "model": "res.partner",
81
+ "report_type": "qweb-pdf",
82
+ "report_name": "report_test",
83
+ }
84
+ )
@@ -0,0 +1,29 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <odoo>
3
+ <record model="ir.ui.view" id="report_form_view">
4
+ <field name="name">ir.actions.report.form</field>
5
+ <field name="model">ir.actions.report</field>
6
+ <field name="priority" eval="5" />
7
+ <field name="inherit_id" ref="base.act_report_xml_view" />
8
+ <field name="arch" type="xml">
9
+ <xpath expr="//button[@name='unlink_action']" position="after">
10
+ <button
11
+ name="%(base_report_auto_create_qweb.report_duplicate_action)d"
12
+ string="Duplicate Report"
13
+ type="action"
14
+ icon="fa-copy"
15
+ />
16
+ </xpath>
17
+ <button name="associated_view" position="after">
18
+ <button
19
+ type="object"
20
+ name="button_create_qweb"
21
+ string="Create QWeb view"
22
+ icon="fa-plus-square-o"
23
+ attrs="{'invisible':[('report_type', 'not in', ['qweb-pdf', 'qweb-html'])]}"
24
+ />
25
+ </button>
26
+
27
+ </field>
28
+ </record>
29
+ </odoo>