Merge lp:~tadeus-prastowo/openobject-jasper-reports/7.0 into lp:openobject-jasper-reports
- 7.0
- Merge into trunk
Proposed by
Tadeus Prastowo
Status: | Superseded |
---|---|
Proposed branch: | lp:~tadeus-prastowo/openobject-jasper-reports/7.0 |
Merge into: | lp:openobject-jasper-reports |
Diff against target: |
1256 lines (+541/-238) (has conflicts) 16 files modified
jasper_reports/JasperReports/BrowseDataGenerator.py (+26/-16) jasper_reports/JasperReports/JasperReport.py (+20/-9) jasper_reports/JasperReports/JasperServer.py (+19/-14) jasper_reports/JasperReports/RecordDataGenerator.py (+0/-2) jasper_reports/__init__.py (+13/-3) jasper_reports/__openerp__.py (+57/-0) jasper_reports/__terp__.py (+0/-49) jasper_reports/http_server.py (+9/-7) jasper_reports/i18n/ca@valencia.po (+217/-0) jasper_reports/jasper_report.py (+46/-29) jasper_reports/jasper_wizard.xml (+4/-7) jasper_reports/report_xml.py (+23/-20) jasper_reports/wizard/__init__.py (+1/-1) jasper_reports/wizard/create_data_template.py (+0/-81) jasper_reports/wizard/jasper_create_data_template.py (+70/-0) jasper_reports/wizard/jasper_create_data_template.xml (+36/-0) Conflict adding file jasper_reports/i18n/ca@valencia.po. Moved existing file to jasper_reports/i18n/ca@valencia.po.moved. |
To merge this branch: | bzr merge lp:~tadeus-prastowo/openobject-jasper-reports/7.0 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Omar (Pexego) | Pending | ||
Review via email: mp+168343@code.launchpad.net |
This proposal has been superseded by a proposal from 2013-06-10.
Commit message
Description of the change
Make jasper_reports module run under OpenERP version 7.0 upwards by adjusting the import statements to comply with OpenERP 7.0 explicit namespaces.
To post a comment you must log in.
Unmerged revisions
- 182. By Eus
-
Adjust import statements to use OpenERP 7.0 explicit namespaces
- 181. By Eus
-
Incorporating latest updates to openobject-
jasper- reports/ 6.0 - 180. By Omar (Pexego)
-
Merged Bruce Doan merge proposal that convert create xml template wizard to osv_memory
- 179. By Omar (Pexego)
-
[FIX] If first translation of attachments, user or special had blanks, output xmls were malformed
- 178. By Omar (Pexego)
-
[FIX] Web client doesn't pass 'model' in data dictionary, but it does context[
'active_ model'] . - 177. By Omar (Pexego)
-
[ADD] bzr add __openerp__.py
- 176. By Omar (Pexego)
-
jasper_reports: Ported to 6.1
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'jasper_reports/JasperReports/BrowseDataGenerator.py' |
2 | --- jasper_reports/JasperReports/BrowseDataGenerator.py 2012-03-04 01:25:44 +0000 |
3 | +++ jasper_reports/JasperReports/BrowseDataGenerator.py 2013-06-10 04:30:42 +0000 |
4 | @@ -1,7 +1,12 @@ |
5 | +# -*- coding: utf-8 -*- |
6 | ############################################################################## |
7 | # |
8 | # Copyright (c) 2008-2012 NaN Projectes de Programari Lliure, S.L. |
9 | # http://www.NaN-tic.com |
10 | +# Copyright (c) 2012 Omar Castiñeira Saavedra <omar@pexego.es> |
11 | +# Pexego Sistemas Informáticos http://www.pexego.es |
12 | +# Copyright (C) 2013 Tadeus Prastowo <tadeus.prastowo@infi-nity.com> |
13 | +# Vikasa Infinity Anugrah <http://www.infi-nity.com> |
14 | # |
15 | # WARNING: This program as such is intended to be used by professional |
16 | # programmers who take the whole responsability of assessing all potential |
17 | @@ -31,10 +36,18 @@ |
18 | import copy |
19 | import base64 |
20 | from xml.dom.minidom import getDOMImplementation |
21 | -import xml.dom.minidom |
22 | -from osv import orm, osv, fields |
23 | -import tempfile |
24 | + |
25 | +try: |
26 | + import release |
27 | + from osv import orm, osv, fields |
28 | +except ImportError: |
29 | + import openerp |
30 | + from openerp import release |
31 | + from openerp.osv import orm, osv, fields |
32 | + |
33 | +import tempfile |
34 | import codecs |
35 | +import logging |
36 | |
37 | from JasperReport import * |
38 | from AbstractDataGenerator import * |
39 | @@ -51,18 +64,11 @@ |
40 | self._languages = [] |
41 | self.imageFiles = {} |
42 | self.temporaryFiles = [] |
43 | + self.logger = logging.getLogger(__name__) |
44 | |
45 | - try: |
46 | - # Do not depend on being called inside OpenERP server |
47 | - import netsvc |
48 | - self.logger = netsvc.Logger() |
49 | - self.WARNING = netsvc.LOG_WARNING |
50 | - except: |
51 | - self.logger = None |
52 | - |
53 | def warning(self, message): |
54 | if self.logger: |
55 | - self.logger.notifyChannel("jasper_reports", self.WARNING, message ) |
56 | + self.logger.warning("%s" % message) |
57 | else: |
58 | print 'JasperReports: %s' % message |
59 | |
60 | @@ -85,6 +91,10 @@ |
61 | value = model.read(self.cr, self.uid, [id], [field], context=context) |
62 | values[ language ] = value[0][field] or '' |
63 | |
64 | + if model._columns[field]._type == 'selection' and model._columns[field].selection: |
65 | + field_data = model.fields_get(self.cr, self.uid, allfields=[field], context=context) |
66 | + values[ language ] = dict(field_data[field]['selection']).get(values[ language ],values[ language ]) |
67 | + |
68 | result = [] |
69 | for key, value in values.iteritems(): |
70 | result.append( '%s~%s' % (key, value) ) |
71 | @@ -124,7 +134,7 @@ |
72 | # If we wanted an INNER JOIN we wouldn't check for "value" and |
73 | # return an empty currentRecords |
74 | if value: |
75 | - # Only |
76 | + # Only |
77 | newRecords = [] |
78 | for v in value: |
79 | currentNewRecords = [] |
80 | @@ -137,7 +147,7 @@ |
81 | |
82 | currentRecords = newRecords |
83 | return currentRecords |
84 | - |
85 | + |
86 | class XmlBrowseDataGenerator(BrowseDataGenerator): |
87 | # XML file generation works as follows: |
88 | # By default (if no OPENERP_RELATIONS property exists in the report) a record will be created |
89 | @@ -229,7 +239,7 @@ |
90 | elif value == False: |
91 | value = '' |
92 | elif field_type == 'date': |
93 | - value = '%s 00:00:00' % str(value) |
94 | + value = '%s 00:00:00' % str(value) |
95 | elif field_type == 'binary': |
96 | imageId = (record.id, field) |
97 | if imageId in self.imageFiles: |
98 | @@ -384,7 +394,7 @@ |
99 | elif value in (False,None): |
100 | value = '' |
101 | elif field_type == 'date': |
102 | - value = '%s 00:00:00' % str(value) |
103 | + value = '%s 00:00:00' % str(value) |
104 | elif field_type == 'binary': |
105 | imageId = (record.id, field) |
106 | if imageId in self.imageFiles: |
107 | |
108 | === modified file 'jasper_reports/JasperReports/JasperReport.py' |
109 | --- jasper_reports/JasperReports/JasperReport.py 2012-03-04 01:25:44 +0000 |
110 | +++ jasper_reports/JasperReports/JasperReport.py 2013-06-10 04:30:42 +0000 |
111 | @@ -1,7 +1,10 @@ |
112 | +# -*- encoding: utf-8 -*- |
113 | ############################################################################## |
114 | # |
115 | # Copyright (c) 2008-2012 NaN Projectes de Programari Lliure, S.L. |
116 | # http://www.NaN-tic.com |
117 | +# Copyright (C) 2013 Tadeus Prastowo <tadeus.prastowo@infi-nity.com> |
118 | +# Vikasa Infinity Anugrah <http://www.infi-nity.com> |
119 | # |
120 | # WARNING: This program as such is intended to be used by professional |
121 | # programmers who take the whole responsability of assessing all potential |
122 | @@ -29,8 +32,16 @@ |
123 | import os |
124 | from lxml import etree |
125 | import re |
126 | -from tools.safe_eval import safe_eval |
127 | -import tools |
128 | + |
129 | +try: |
130 | + import release |
131 | + from tools.safe_eval import safe_eval |
132 | + import tools |
133 | +except ImportError: |
134 | + import openerp |
135 | + from openerp import release |
136 | + from openerp.tools.safe_eval import safe_eval |
137 | + from openerp import tools |
138 | |
139 | dataSourceExpressionRegExp = re.compile( r"""\$P\{(\w+)\}""" ) |
140 | |
141 | @@ -121,10 +132,10 @@ |
142 | } |
143 | fieldNames.append( name ) |
144 | return fields, fieldNames |
145 | - |
146 | + |
147 | def extractProperties(self): |
148 | # The function will read all relevant information from the jrxml file |
149 | - |
150 | + |
151 | doc = etree.parse( self._reportPath ) |
152 | |
153 | # Define namespaces |
154 | @@ -132,14 +143,14 @@ |
155 | nss = {'jr': ns} |
156 | |
157 | # Language |
158 | - |
159 | + |
160 | # Note that if either queryString or language do not exist the default (from the constructor) |
161 | # is XPath. |
162 | langTags = doc.xpath( '/jr:jasperReport/jr:queryString', namespaces=nss ) |
163 | if langTags: |
164 | if langTags[0].get('language'): |
165 | self._language = langTags[0].get('language').lower() |
166 | - |
167 | + |
168 | # Relations |
169 | relationTags = doc.xpath( '/jr:jasperReport/jr:property[@name="OPENERP_RELATIONS"]', namespaces=nss ) |
170 | if relationTags and 'value' in relationTags[0].keys(): |
171 | @@ -209,7 +220,7 @@ |
172 | modelTags = tag.xpath( '//jr:reportElement/jr:property[@name="OPENERP_MODEL"]', namespaces=nss ) |
173 | if modelTags and 'value' in modelTags[0].keys(): |
174 | model = modelTags[0].get('value') |
175 | - |
176 | + |
177 | pathPrefix = '' |
178 | pathPrefixTags = tag.xpath( '//jr:reportElement/jr:property[@name="OPENERP_PATH_PREFIX"]', namespaces=nss ) |
179 | if pathPrefixTags and 'value' in pathPrefixTags[0].keys(): |
180 | @@ -239,7 +250,7 @@ |
181 | }) |
182 | for subsubInfo in subreport.subreports(): |
183 | subsubInfo['depth'] += 1 |
184 | - # Note hat 'parameter' (the one used to pass report's DataSource) must be |
185 | + # Note hat 'parameter' (the one used to pass report's DataSource) must be |
186 | # the same in all reports |
187 | self._subreports.append( subsubInfo ) |
188 | |
189 | @@ -294,7 +305,7 @@ |
190 | modelTags = tag.xpath( '../../jr:reportElement/jr:property[@name="OPENERP_MODEL"]', namespaces=nss ) |
191 | if modelTags and 'value' in modelTags[0].keys(): |
192 | model = modelTags[0].get('value') |
193 | - |
194 | + |
195 | pathPrefix = '' |
196 | pathPrefixTags = tag.xpath( '../../jr:reportElement/jr:property[@name="OPENERP_PATH_PREFIX"]', namespaces=nss ) |
197 | if pathPrefixTags and 'value' in pathPrefixTags[0].keys(): |
198 | |
199 | === modified file 'jasper_reports/JasperReports/JasperServer.py' |
200 | --- jasper_reports/JasperReports/JasperServer.py 2012-03-04 01:25:44 +0000 |
201 | +++ jasper_reports/JasperReports/JasperServer.py 2013-06-10 04:30:42 +0000 |
202 | @@ -1,7 +1,10 @@ |
203 | +# -*- encoding: utf-8 -*- |
204 | ############################################################################## |
205 | # |
206 | # Copyright (c) 2008-2012 NaN Projectes de Programari Lliure, S.L. |
207 | # http://www.NaN-tic.com |
208 | +# Copyright (C) 2013 Tadeus Prastowo <tadeus.prastowo@infi-nity.com> |
209 | +# Vikasa Infinity Anugrah <http://www.infi-nity.com> |
210 | # |
211 | # WARNING: This program as such is intended to be used by professional |
212 | # programmers who take the whole responsability of assessing all potential |
213 | @@ -27,13 +30,22 @@ |
214 | ############################################################################## |
215 | |
216 | import os |
217 | -from osv import osv |
218 | import glob |
219 | import time |
220 | import socket |
221 | import subprocess |
222 | import xmlrpclib |
223 | -from tools.translate import _ |
224 | +import logging |
225 | + |
226 | +try: |
227 | + import release |
228 | + from osv import osv |
229 | + from tools.translate import _ |
230 | +except ImportError: |
231 | + import openerp |
232 | + from openerp import release |
233 | + from openerp.osv import osv |
234 | + from openerp.tools.translate import _ |
235 | |
236 | class JasperServer: |
237 | def __init__(self, port=8090): |
238 | @@ -41,18 +53,11 @@ |
239 | self.pidfile = None |
240 | url = 'http://localhost:%d' % port |
241 | self.proxy = xmlrpclib.ServerProxy( url, allow_none = True ) |
242 | - |
243 | - try: |
244 | - # Do not depend on being called inside OpenERP server |
245 | - import netsvc |
246 | - self.logger = netsvc.Logger() |
247 | - self.ERROR = netsvc.LOG_ERROR |
248 | - except: |
249 | - self.logger = None |
250 | + self.logger = logging.getLogger(__name__) |
251 | |
252 | def error(self, message): |
253 | if self.logger: |
254 | - self.logger.notifyChannel("jasper_reports", self.ERROR, message ) |
255 | + self.logger.error("%s" % message ) |
256 | else: |
257 | print 'JasperReports: %s' % message |
258 | |
259 | @@ -73,14 +78,14 @@ |
260 | env['CLASSPATH'] = os.path.join( self.path(), '..', 'java' + sep ) + sep.join( glob.glob( libs ) ) + sep + os.path.join( self.path(), '..', 'custom_reports' ) |
261 | cwd = os.path.join( self.path(), '..', 'java' ) |
262 | |
263 | - # Set headless = True because otherwise, java may use existing X session and if session is |
264 | + # Set headless = True because otherwise, java may use existing X session and if session is |
265 | # closed JasperServer would start throwing exceptions. So we better avoid using the session at all. |
266 | command = ['java', '-Djava.awt.headless=true', 'com.nantic.jasperreports.JasperServer', unicode(self.port)] |
267 | process = subprocess.Popen(command, env=env, cwd=cwd) |
268 | if self.pidfile: |
269 | f = open( self.pidfile, 'w') |
270 | try: |
271 | - f.write( str( process.pid ) ) |
272 | + f.write( str( process.pid ) ) |
273 | finally: |
274 | f.close() |
275 | |
276 | @@ -88,7 +93,7 @@ |
277 | """ |
278 | Render report and return the number of pages generated. |
279 | """ |
280 | - try: |
281 | + try: |
282 | return self.proxy.Report.execute( *args ) |
283 | except (xmlrpclib.ProtocolError, socket.error), e: |
284 | #self.info("First try did not work: %s / %s" % (str(e), str(e.args)) ) |
285 | |
286 | === modified file 'jasper_reports/JasperReports/RecordDataGenerator.py' |
287 | --- jasper_reports/JasperReports/RecordDataGenerator.py 2012-03-04 01:25:44 +0000 |
288 | +++ jasper_reports/JasperReports/RecordDataGenerator.py 2013-06-10 04:30:42 +0000 |
289 | @@ -26,10 +26,8 @@ |
290 | # |
291 | ############################################################################## |
292 | |
293 | -import os |
294 | import csv |
295 | from xml.dom.minidom import getDOMImplementation |
296 | -import xml.dom.minidom |
297 | import codecs |
298 | |
299 | from JasperReport import * |
300 | |
301 | === modified file 'jasper_reports/__init__.py' |
302 | --- jasper_reports/__init__.py 2012-03-04 01:25:44 +0000 |
303 | +++ jasper_reports/__init__.py 2013-06-10 04:30:42 +0000 |
304 | @@ -1,7 +1,10 @@ |
305 | +# -*- encoding: utf-8 -*- |
306 | ############################################################################## |
307 | # |
308 | # Copyright (c) 2008-2012 NaN Projectes de Programari Lliure, S.L. |
309 | # http://www.NaN-tic.com |
310 | +# Copyright (C) 2013 Tadeus Prastowo <tadeus.prastowo@infi-nity.com> |
311 | +# Vikasa Infinity Anugrah <http://www.infi-nity.com> |
312 | # |
313 | # WARNING: This program as such is intended to be used by professional |
314 | # programmers who take the whole responsability of assessing all potential |
315 | @@ -25,10 +28,17 @@ |
316 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
317 | # |
318 | ############################################################################## |
319 | + |
320 | from jasper_report import * |
321 | from report_xml import * |
322 | import wizard |
323 | |
324 | -import release |
325 | -if release.major_version != '5.0': |
326 | - from http_server import * |
327 | +try: |
328 | + import release |
329 | + if release.major_version != '5.0': |
330 | + from http_server import * |
331 | +except ImportError: |
332 | + import openerp |
333 | + from openerp import release |
334 | + if release.major_version != '5.0': |
335 | + from openerp.service.http_server import * |
336 | |
337 | === added file 'jasper_reports/__openerp__.py' |
338 | --- jasper_reports/__openerp__.py 1970-01-01 00:00:00 +0000 |
339 | +++ jasper_reports/__openerp__.py 2013-06-10 04:30:42 +0000 |
340 | @@ -0,0 +1,57 @@ |
341 | +# -*- encoding: utf-8 -*- |
342 | +############################################################################## |
343 | +# |
344 | +# Copyright (c) 2008-2012 NaN Projectes de Programari Lliure, S.L. |
345 | +# http://www.NaN-tic.com |
346 | +# Copyright (C) 2013 Tadeus Prastowo <tadeus.prastowo@infi-nity.com> |
347 | +# Vikasa Infinity Anugrah <http://www.infi-nity.com> |
348 | +# |
349 | +# WARNING: This program as such is intended to be used by professional |
350 | +# programmers who take the whole responsability of assessing all potential |
351 | +# consequences resulting from its eventual inadequacies and bugs |
352 | +# End users who are looking for a ready-to-use solution with commercial |
353 | +# garantees and support are strongly adviced to contract a Free Software |
354 | +# Service Company |
355 | +# |
356 | +# This program is Free Software; you can redistribute it and/or |
357 | +# modify it under the terms of the GNU General Public License |
358 | +# as published by the Free Software Foundation; either version 2 |
359 | +# of the License, or (at your option) any later version. |
360 | +# |
361 | +# This program is distributed in the hope that it will be useful, |
362 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
363 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
364 | +# GNU General Public License for more details. |
365 | +# |
366 | +# You should have received a copy of the GNU General Public License |
367 | +# along with this program; if not, write to the Free Software |
368 | +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
369 | +# |
370 | +############################################################################## |
371 | + |
372 | +{ |
373 | + "name" : "Jasper Reports", |
374 | + "version" : "0.1.1", |
375 | + "description" : "This module integrates Jasper Reports with OpenERP.", |
376 | + "author" : "NaN·tic", |
377 | + "website" : "http://www.nan-tic.com", |
378 | + 'images' : [ |
379 | + 'images/jasper_reports-hover.png', |
380 | + 'images/jasper_reports.png' |
381 | + ], |
382 | + "depends" : ["base"], |
383 | + "category" : "Generic Modules/Jasper Reports", |
384 | + "init_xml" : [], |
385 | + "demo_xml" : [ |
386 | + 'jasper_demo.xml' |
387 | + ], |
388 | + "update_xml" : [ |
389 | + 'wizard/jasper_create_data_template.xml', |
390 | + 'jasper_wizard.xml', |
391 | + 'report_xml_view.xml', |
392 | + 'security/ir.model.access.csv', |
393 | + ], |
394 | + "active": False, |
395 | + "installable": True, |
396 | + 'application': True, |
397 | +} |
398 | |
399 | === removed file 'jasper_reports/__terp__.py' |
400 | --- jasper_reports/__terp__.py 2012-03-04 01:25:44 +0000 |
401 | +++ jasper_reports/__terp__.py 1970-01-01 00:00:00 +0000 |
402 | @@ -1,49 +0,0 @@ |
403 | -############################################################################## |
404 | -# |
405 | -# Copyright (c) 2008-2012 NaN Projectes de Programari Lliure, S.L. |
406 | -# http://www.NaN-tic.com |
407 | -# |
408 | -# WARNING: This program as such is intended to be used by professional |
409 | -# programmers who take the whole responsability of assessing all potential |
410 | -# consequences resulting from its eventual inadequacies and bugs |
411 | -# End users who are looking for a ready-to-use solution with commercial |
412 | -# garantees and support are strongly adviced to contract a Free Software |
413 | -# Service Company |
414 | -# |
415 | -# This program is Free Software; you can redistribute it and/or |
416 | -# modify it under the terms of the GNU General Public License |
417 | -# as published by the Free Software Foundation; either version 2 |
418 | -# of the License, or (at your option) any later version. |
419 | -# |
420 | -# This program is distributed in the hope that it will be useful, |
421 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
422 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
423 | -# GNU General Public License for more details. |
424 | -# |
425 | -# You should have received a copy of the GNU General Public License |
426 | -# along with this program; if not, write to the Free Software |
427 | -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
428 | -# |
429 | -############################################################################## |
430 | - |
431 | -{ |
432 | - "name" : "Jasper Reports", |
433 | - "version" : "0.1", |
434 | - "description" : "This module integrates Jasper Reports with OpenERP.", |
435 | - "author" : "NaN·tic", |
436 | - "website" : "http://www.nan-tic.com", |
437 | - "depends" : ["base"], |
438 | - "category" : "Generic Modules/Jasper Reports", |
439 | - "init_xml" : [], |
440 | - "demo_xml" : [ |
441 | - 'jasper_demo.xml' |
442 | - ], |
443 | - "update_xml" : [ |
444 | - 'jasper_wizard.xml', |
445 | - 'report_xml_view.xml', |
446 | - 'security/ir.model.access.csv', |
447 | - ], |
448 | - "active": False, |
449 | - "installable": True |
450 | -} |
451 | - |
452 | |
453 | === modified file 'jasper_reports/http_server.py' |
454 | --- jasper_reports/http_server.py 2012-03-04 01:25:44 +0000 |
455 | +++ jasper_reports/http_server.py 2013-06-10 04:30:42 +0000 |
456 | @@ -1,7 +1,10 @@ |
457 | +# -*- coding: utf-8 -*- |
458 | ############################################################################## |
459 | # |
460 | # Copyright (c) 2008-2012 NaN Projectes de Programari Lliure, S.L. |
461 | # http://www.NaN-tic.com |
462 | +# Copyright (c) 2012 Omar Castiñeira Saavedra <omar@pexego.es> |
463 | +# Pexego Sistemas Informáticos http://www.pexego.es |
464 | # |
465 | # WARNING: This program as such is intended to be used by professional |
466 | # programmers who take the whole responsability of assessing all potential |
467 | @@ -26,9 +29,8 @@ |
468 | # |
469 | ############################################################################## |
470 | |
471 | -from service.http_server import reg_http_service, HttpDaemon |
472 | -from service.websrv_lib import HTTPDir |
473 | -from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer |
474 | +from service.http_server import reg_http_service |
475 | +from BaseHTTPServer import BaseHTTPRequestHandler |
476 | import netsvc |
477 | import tools |
478 | |
479 | @@ -36,7 +38,7 @@ |
480 | def __init__(self): |
481 | self.status = False |
482 | |
483 | -class JasperHandler(netsvc.OpenERPDispatcher, BaseHTTPRequestHandler): |
484 | +class JasperHandler(BaseHTTPRequestHandler): |
485 | cache = {} |
486 | |
487 | def __init__(self, request, client_address, server): |
488 | @@ -90,12 +92,12 @@ |
489 | 'lang': language, |
490 | } |
491 | |
492 | - uid = self.dispatch('common', 'login', (database, user, password) ) |
493 | - result = self.dispatch('object', 'execute', (database, uid, password, 'ir.actions.report.xml', 'create_xml', model, depth, context) ) |
494 | + uid = netsvc.dispatch_rpc('common', 'login', (database, user, password)) |
495 | + result = netsvc.dispatch_rpc('object', 'execute', (database, uid, password, 'ir.actions.report.xml', 'create_xml', model, depth, context)) |
496 | |
497 | if use_cache: |
498 | self.cache[key] = result |
499 | |
500 | return result |
501 | |
502 | -reg_http_service(HTTPDir('/jasper/', JasperHandler)) |
503 | +reg_http_service('/jasper/', JasperHandler) |
504 | |
505 | === added file 'jasper_reports/i18n/ca@valencia.po' |
506 | --- jasper_reports/i18n/ca@valencia.po 1970-01-01 00:00:00 +0000 |
507 | +++ jasper_reports/i18n/ca@valencia.po 2013-06-10 04:30:42 +0000 |
508 | @@ -0,0 +1,217 @@ |
509 | +# Catalan (Valencian) translation for openobject-jasper-reports |
510 | +# Copyright (c) 2013 Rosetta Contributors and Canonical Ltd 2013 |
511 | +# This file is distributed under the same license as the openobject-jasper-reports package. |
512 | +# FIRST AUTHOR <EMAIL@ADDRESS>, 2013. |
513 | +# |
514 | +msgid "" |
515 | +msgstr "" |
516 | +"Project-Id-Version: openobject-jasper-reports\n" |
517 | +"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n" |
518 | +"POT-Creation-Date: 2010-06-27 14:39+0000\n" |
519 | +"PO-Revision-Date: 2013-01-08 19:18+0000\n" |
520 | +"Last-Translator: Pablo Fuentes Rodríguez (Studio73) <pablo@studio73.es>\n" |
521 | +"Language-Team: Catalan (Valencian) <ca@valencia@li.org>\n" |
522 | +"MIME-Version: 1.0\n" |
523 | +"Content-Type: text/plain; charset=UTF-8\n" |
524 | +"Content-Transfer-Encoding: 8bit\n" |
525 | +"X-Launchpad-Export-Date: 2013-01-09 05:24+0000\n" |
526 | +"X-Generator: Launchpad (build 16412)\n" |
527 | + |
528 | +#. module: jasper_reports |
529 | +#: field:ir.actions.report.xml,jasper_report:0 |
530 | +msgid "Is Jasper Report?" |
531 | +msgstr "Es Jasper Report?" |
532 | + |
533 | +#. module: jasper_reports |
534 | +#: constraint:ir.model:0 |
535 | +msgid "" |
536 | +"The Object name must start with x_ and not contain any special character !" |
537 | +msgstr "" |
538 | +"El nom de l'objecte ha de començar amb x_ i no pot contenir cap caràcter " |
539 | +"especial!" |
540 | + |
541 | +#. module: jasper_reports |
542 | +#: wizard_button:jasper_create_data_template,init,create:0 |
543 | +msgid "Create" |
544 | +msgstr "Crea" |
545 | + |
546 | +#. module: jasper_reports |
547 | +#: field:ir.actions.report.xml,jasper_output:0 |
548 | +msgid "Jasper Output" |
549 | +msgstr "Eixida de Jasper" |
550 | + |
551 | +#. module: jasper_reports |
552 | +#: constraint:ir.actions.act_window:0 |
553 | +msgid "Invalid model name in the action definition." |
554 | +msgstr "Nom de model no vàlid en la definició de l'acció" |
555 | + |
556 | +#. module: jasper_reports |
557 | +#: selection:ir.actions.report.xml,jasper_output:0 |
558 | +msgid "XLS" |
559 | +msgstr "XLS" |
560 | + |
561 | +#. module: jasper_reports |
562 | +#: view:ir.actions.report.xml:0 |
563 | +#: field:ir.actions.report.xml,jasper_file_ids:0 |
564 | +msgid "Files" |
565 | +msgstr "Fitxers" |
566 | + |
567 | +#. module: jasper_reports |
568 | +#: selection:ir.actions.report.xml,jasper_output:0 |
569 | +msgid "RTF" |
570 | +msgstr "RTF" |
571 | + |
572 | +#. module: jasper_reports |
573 | +#: view:ir.actions.report.xml:0 |
574 | +msgid "Update from attachments" |
575 | +msgstr "Actualitzar des d'adjunts" |
576 | + |
577 | +#. module: jasper_reports |
578 | +#: model:ir.actions.act_window,name:jasper_reports.ir_action_report_jasper |
579 | +#: view:ir.actions.report.xml:0 |
580 | +#: model:ir.module.module,shortdesc:jasper_reports.module_meta_information |
581 | +#: model:ir.ui.menu,name:jasper_reports.jasper_reports_menu |
582 | +#: model:ir.ui.menu,name:jasper_reports.menu_ir_action_report_jasper |
583 | +msgid "Jasper Reports" |
584 | +msgstr "Jasper Reports" |
585 | + |
586 | +#. module: jasper_reports |
587 | +#: selection:ir.actions.report.xml,jasper_output:0 |
588 | +msgid "ODS" |
589 | +msgstr "" |
590 | + |
591 | +#. module: jasper_reports |
592 | +#: selection:ir.actions.report.xml,jasper_output:0 |
593 | +msgid "ODT" |
594 | +msgstr "" |
595 | + |
596 | +#. module: jasper_reports |
597 | +#: code:addons/jasper_reports/report_xml.py:0 |
598 | +#, python-format |
599 | +msgid "There is more than one report marked as default" |
600 | +msgstr "" |
601 | + |
602 | +#. module: jasper_reports |
603 | +#: selection:ir.actions.report.xml,jasper_output:0 |
604 | +msgid "HTML" |
605 | +msgstr "" |
606 | + |
607 | +#. module: jasper_reports |
608 | +#: code:addons/jasper_reports/wizard/create_data_template.py:0 |
609 | +#, python-format |
610 | +msgid "User" |
611 | +msgstr "" |
612 | + |
613 | +#. module: jasper_reports |
614 | +#: view:ir.actions.report.xml:0 |
615 | +msgid "Groups" |
616 | +msgstr "" |
617 | + |
618 | +#. module: jasper_reports |
619 | +#: field:ir.actions.report.xml.file,report_id:0 |
620 | +msgid "Report" |
621 | +msgstr "" |
622 | + |
623 | +#. module: jasper_reports |
624 | +#: wizard_field:jasper_create_data_template,create,data:0 |
625 | +msgid "XML" |
626 | +msgstr "" |
627 | + |
628 | +#. module: jasper_reports |
629 | +#: constraint:ir.ui.view:0 |
630 | +msgid "Invalid XML for View Architecture!" |
631 | +msgstr "" |
632 | + |
633 | +#. module: jasper_reports |
634 | +#: model:ir.model,name:jasper_reports.model_ir_actions_report_xml_file |
635 | +msgid "ir.actions.report.xml.file" |
636 | +msgstr "" |
637 | + |
638 | +#. module: jasper_reports |
639 | +#: model:ir.actions.wizard,name:jasper_reports.jasper_create_data_template_action |
640 | +#: model:ir.ui.menu,name:jasper_reports.jasper_create_data_template_menu |
641 | +#: wizard_view:jasper_create_data_template,create:0 |
642 | +#: wizard_view:jasper_create_data_template,init:0 |
643 | +msgid "Create Data Template" |
644 | +msgstr "" |
645 | + |
646 | +#. module: jasper_reports |
647 | +#: field:ir.actions.report.xml.file,default:0 |
648 | +msgid "Default" |
649 | +msgstr "" |
650 | + |
651 | +#. module: jasper_reports |
652 | +#: code:addons/jasper_reports/report_xml.py:0 |
653 | +#, python-format |
654 | +msgid "No report has been marked as default." |
655 | +msgstr "" |
656 | + |
657 | +#. module: jasper_reports |
658 | +#: wizard_field:jasper_create_data_template,init,depth:0 |
659 | +msgid "Depth" |
660 | +msgstr "" |
661 | + |
662 | +#. module: jasper_reports |
663 | +#: code:addons/jasper_reports/report_xml.py:0 |
664 | +#, python-format |
665 | +msgid "Error" |
666 | +msgstr "" |
667 | + |
668 | +#. module: jasper_reports |
669 | +#: selection:ir.actions.report.xml,jasper_output:0 |
670 | +msgid "PDF" |
671 | +msgstr "" |
672 | + |
673 | +#. module: jasper_reports |
674 | +#: field:ir.actions.report.xml,jasper_model_id:0 |
675 | +#: wizard_field:jasper_create_data_template,create,model:0 |
676 | +#: wizard_field:jasper_create_data_template,init,model:0 |
677 | +msgid "Model" |
678 | +msgstr "" |
679 | + |
680 | +#. module: jasper_reports |
681 | +#: selection:ir.actions.report.xml,jasper_output:0 |
682 | +msgid "CSV" |
683 | +msgstr "" |
684 | + |
685 | +#. module: jasper_reports |
686 | +#: view:ir.actions.report.xml.file:0 |
687 | +msgid "Jasper Reports File" |
688 | +msgstr "" |
689 | + |
690 | +#. module: jasper_reports |
691 | +#: code:addons/jasper_reports/wizard/create_data_template.py:0 |
692 | +#, python-format |
693 | +msgid "Attachments" |
694 | +msgstr "" |
695 | + |
696 | +#. module: jasper_reports |
697 | +#: selection:ir.actions.report.xml,jasper_output:0 |
698 | +msgid "Text" |
699 | +msgstr "" |
700 | + |
701 | +#. module: jasper_reports |
702 | +#: field:ir.actions.report.xml.file,filename:0 |
703 | +#: wizard_field:jasper_create_data_template,create,filename:0 |
704 | +msgid "File Name" |
705 | +msgstr "" |
706 | + |
707 | +#. module: jasper_reports |
708 | +#: wizard_button:jasper_create_data_template,create,end:0 |
709 | +msgid "Accept" |
710 | +msgstr "" |
711 | + |
712 | +#. module: jasper_reports |
713 | +#: model:ir.module.module,description:jasper_reports.module_meta_information |
714 | +msgid "This module integrates Jasper Reports with OpenERP." |
715 | +msgstr "" |
716 | + |
717 | +#. module: jasper_reports |
718 | +#: field:ir.actions.report.xml.file,file:0 |
719 | +msgid "File" |
720 | +msgstr "" |
721 | + |
722 | +#. module: jasper_reports |
723 | +#: wizard_button:jasper_create_data_template,init,end:0 |
724 | +msgid "Cancel" |
725 | +msgstr "" |
726 | |
727 | === renamed file 'jasper_reports/i18n/ca@valencia.po' => 'jasper_reports/i18n/ca@valencia.po.moved' |
728 | === added directory 'jasper_reports/images' |
729 | === added file 'jasper_reports/images/jasper_reports-hover.png' |
730 | Binary files jasper_reports/images/jasper_reports-hover.png 1970-01-01 00:00:00 +0000 and jasper_reports/images/jasper_reports-hover.png 2013-06-10 04:30:42 +0000 differ |
731 | === added file 'jasper_reports/images/jasper_reports.png' |
732 | Binary files jasper_reports/images/jasper_reports.png 1970-01-01 00:00:00 +0000 and jasper_reports/images/jasper_reports.png 2013-06-10 04:30:42 +0000 differ |
733 | === modified file 'jasper_reports/jasper_report.py' |
734 | --- jasper_reports/jasper_report.py 2012-03-04 01:25:44 +0000 |
735 | +++ jasper_reports/jasper_report.py 2013-06-10 04:30:42 +0000 |
736 | @@ -1,7 +1,10 @@ |
737 | +# -*- encoding: utf-8 -*- |
738 | ############################################################################## |
739 | # |
740 | # Copyright (c) 2008-2012 NaN Projectes de Programari Lliure, S.L. |
741 | # http://www.NaN-tic.com |
742 | +# Copyright (C) 2013 Tadeus Prastowo <tadeus.prastowo@infi-nity.com> |
743 | +# Vikasa Infinity Anugrah <http://www.infi-nity.com> |
744 | # |
745 | # WARNING: This program as such is intended to be used by professional |
746 | # programmers who take the whole responsability of assessing all potential |
747 | @@ -25,19 +28,26 @@ |
748 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
749 | # |
750 | ############################################################################## |
751 | + |
752 | +try: |
753 | + import release |
754 | + import report |
755 | + import pooler |
756 | + from osv import orm, osv, fields |
757 | + import tools |
758 | + import netsvc |
759 | +except ImportError: |
760 | + import openerp |
761 | + from openerp import release |
762 | + from openerp import report |
763 | + from openerp import pooler |
764 | + from openerp.osv import orm, osv, fields |
765 | + from openerp import tools |
766 | + from openerp import netsvc |
767 | + |
768 | import os |
769 | -import csv |
770 | -import copy |
771 | -import base64 |
772 | -import report |
773 | -import pooler |
774 | -from osv import orm, osv, fields |
775 | -import tools |
776 | -import tempfile |
777 | -import codecs |
778 | -import sql_db |
779 | -import netsvc |
780 | -import release |
781 | +import tempfile |
782 | +import logging |
783 | |
784 | from JasperReports import * |
785 | |
786 | @@ -57,7 +67,7 @@ |
787 | self.uid = uid |
788 | self.ids = ids |
789 | self.data = data |
790 | - self.model = self.data['model'] |
791 | + self.model = self.data.get('model', False) or context.get('active_model', False) |
792 | self.context = context or {} |
793 | self.pool = pooler.get_pool( self.cr.dbname ) |
794 | self.reportPath = None |
795 | @@ -70,7 +80,7 @@ |
796 | If self.context contains "return_pages = True" it will return the number of pages |
797 | of the generated report. |
798 | """ |
799 | - logger = netsvc.Logger() |
800 | + logger = logging.getLogger(__name__) |
801 | |
802 | # * Get report path * |
803 | # Not only do we search the report by name but also ensure that 'report_rml' field |
804 | @@ -85,19 +95,21 @@ |
805 | self.outputFormat = data['jasper_output'] |
806 | self.reportPath = data['report_rml'] |
807 | self.reportPath = os.path.join( self.addonsPath(), self.reportPath ) |
808 | + if not os.path.lexists(self.reportPath): |
809 | + self.reportPath = self.addonsPath(path=data['report_rml']) |
810 | |
811 | # Get report information from the jrxml file |
812 | - logger.notifyChannel("jasper_reports", netsvc.LOG_INFO, "Requested report: '%s'" % self.reportPath) |
813 | + logger.info("Requested report: '%s'" % self.reportPath) |
814 | self.report = JasperReport( self.reportPath ) |
815 | |
816 | - # Create temporary input (XML) and output (PDF) files |
817 | + # Create temporary input (XML) and output (PDF) files |
818 | fd, dataFile = tempfile.mkstemp() |
819 | os.close(fd) |
820 | fd, outputFile = tempfile.mkstemp() |
821 | os.close(fd) |
822 | self.temporaryFiles.append( dataFile ) |
823 | self.temporaryFiles.append( outputFile ) |
824 | - logger.notifyChannel("jasper_reports", netsvc.LOG_INFO, "Temporary data file: '%s'" % dataFile) |
825 | + logger.info("Temporary data file: '%s'" % dataFile) |
826 | |
827 | import time |
828 | start = time.time() |
829 | @@ -110,7 +122,7 @@ |
830 | generator = CsvBrowseDataGenerator( self.report, self.model, self.pool, self.cr, self.uid, self.ids, self.context ) |
831 | generator.generate( dataFile ) |
832 | self.temporaryFiles += generator.temporaryFiles |
833 | - |
834 | + |
835 | subreportDataFiles = [] |
836 | for subreportInfo in self.report.subreports(): |
837 | subreport = subreportInfo['report'] |
838 | @@ -121,7 +133,7 @@ |
839 | else: |
840 | message += 'without prefix ' |
841 | message += 'for file %s' % subreportInfo['filename'] |
842 | - logger.notifyChannel("jasper_reports", netsvc.LOG_INFO, message) |
843 | + logger.info("%s" % message) |
844 | |
845 | fd, subreportDataFile = tempfile.mkstemp() |
846 | os.close(fd) |
847 | @@ -139,12 +151,12 @@ |
848 | else: |
849 | generator = CsvBrowseDataGenerator( subreport, self.model, self.pool, self.cr, self.uid, self.ids, self.context ) |
850 | generator.generate( subreportDataFile ) |
851 | - |
852 | + |
853 | |
854 | # Call the external java application that will generate the PDF file in outputFile |
855 | pages = self.executeReport( dataFile, outputFile, subreportDataFiles ) |
856 | elapsed = (time.time() - start) / 60 |
857 | - logger.notifyChannel("jasper_reports", netsvc.LOG_INFO, "ELAPSED: '%f'" % elapsed ) |
858 | + logger.info("ELAPSED: %f" % elapsed) |
859 | |
860 | # Read data from the generated file and return it |
861 | f = open( outputFile, 'rb') |
862 | @@ -159,8 +171,7 @@ |
863 | try: |
864 | os.unlink( file ) |
865 | except os.error, e: |
866 | - logger = netsvc.Logger() |
867 | - logger.notifyChannel("jasper_reports", netsvc.LOG_WARNING, "Could not remove file '%s'." % file ) |
868 | + logger.warning("Could not remove file '%s'." % file ) |
869 | self.temporaryFiles = [] |
870 | |
871 | if self.context.get('return_pages'): |
872 | @@ -171,7 +182,13 @@ |
873 | def path(self): |
874 | return os.path.abspath(os.path.dirname(__file__)) |
875 | |
876 | - def addonsPath(self): |
877 | + def addonsPath(self, path=False): |
878 | + if path: |
879 | + report_module = path.split(os.path.sep)[0] |
880 | + for addons_path in tools.config['addons_path'].split(','): |
881 | + if os.path.lexists(addons_path+os.path.sep+report_module): |
882 | + return os.path.normpath( addons_path+os.path.sep+path ) |
883 | + |
884 | return os.path.dirname( self.path() ) |
885 | |
886 | def systemUserName(self): |
887 | @@ -187,7 +204,7 @@ |
888 | port = tools.config['db_port'] or '5432' |
889 | dbname = self.cr.dbname |
890 | return 'jdbc:postgresql://%s:%s/%s' % ( host, port, dbname ) |
891 | - |
892 | + |
893 | def userName(self): |
894 | return tools.config['db_user'] or self.systemUserName() |
895 | |
896 | @@ -196,7 +213,7 @@ |
897 | |
898 | def executeReport(self, dataFile, outputFile, subreportDataFiles): |
899 | locale = self.context.get('lang', 'en_US') |
900 | - |
901 | + |
902 | connectionParameters = { |
903 | 'output': self.outputFormat, |
904 | #'xml': dataFile, |
905 | @@ -222,8 +239,8 @@ |
906 | class report_jasper(report.interface.report_int): |
907 | def __init__(self, name, model, parser=None ): |
908 | # Remove report name from list of services if it already |
909 | - # exists to avoid report_int's assert. We want to keep the |
910 | - # automatic registration at login, but at the same time we |
911 | + # exists to avoid report_int's assert. We want to keep the |
912 | + # automatic registration at login, but at the same time we |
913 | # need modules to be able to use a parser for certain reports. |
914 | if release.major_version == '5.0': |
915 | if name in netsvc.SERVICES: |
916 | @@ -273,7 +290,7 @@ |
917 | report_jasper( name, model ) |
918 | |
919 | |
920 | - # This hack allows automatic registration of jrxml files without |
921 | + # This hack allows automatic registration of jrxml files without |
922 | # the need for developers to register them programatically. |
923 | |
924 | old_register_all = report.interface.register_all |
925 | |
926 | === modified file 'jasper_reports/jasper_wizard.xml' |
927 | --- jasper_reports/jasper_wizard.xml 2009-08-29 22:32:12 +0000 |
928 | +++ jasper_reports/jasper_wizard.xml 2013-06-10 04:30:42 +0000 |
929 | @@ -1,13 +1,10 @@ |
930 | <?xml version="1.0"?> |
931 | <openerp> |
932 | <data> |
933 | - <record model="ir.actions.wizard" id="jasper_create_data_template_action"> |
934 | - <field name="name">Create Data Template</field> |
935 | - <field name="wiz_name">jasper_create_data_template</field> |
936 | - </record> |
937 | <menuitem parent="base.menu_custom" name="Jasper Reports" id="jasper_reports_menu"/> |
938 | - <menuitem parent="jasper_reports_menu" |
939 | - action="jasper_create_data_template_action" id="jasper_create_data_template_menu" |
940 | - type="wizard"/> |
941 | + <menuitem |
942 | + parent="jasper_reports_menu" |
943 | + action="action_jasper_create_date_template" |
944 | + id="jasper_create_data_template_menu" sequence="1" /> |
945 | </data> |
946 | </openerp> |
947 | |
948 | === modified file 'jasper_reports/report_xml.py' |
949 | --- jasper_reports/report_xml.py 2012-03-04 01:25:44 +0000 |
950 | +++ jasper_reports/report_xml.py 2013-06-10 04:30:42 +0000 |
951 | @@ -3,6 +3,8 @@ |
952 | # |
953 | # Copyright (c) 2008-2012 NaN Projectes de Programari Lliure, S.L. |
954 | # http://www.NaN-tic.com |
955 | +# Copyright (C) 2013 Tadeus Prastowo <tadeus.prastowo@infi-nity.com> |
956 | +# Vikasa Infinity Anugrah <http://www.infi-nity.com> |
957 | # |
958 | # WARNING: This program as such is intended to be used by professional |
959 | # programmers who take the whole responsability of assessing all potential |
960 | @@ -28,25 +30,26 @@ |
961 | ############################################################################## |
962 | |
963 | import os |
964 | -import csv |
965 | -import copy |
966 | import base64 |
967 | -import report |
968 | -import pooler |
969 | -from osv import orm, osv, fields |
970 | -import tools |
971 | -import tempfile |
972 | -import codecs |
973 | -import sql_db |
974 | -import netsvc |
975 | -import jasper_report |
976 | -from tools.translate import _ |
977 | - |
978 | -import string |
979 | + |
980 | +try: |
981 | + import release |
982 | + import report |
983 | + from osv import orm, osv, fields |
984 | + import jasper_report |
985 | + from tools.translate import _ |
986 | +except ImportError: |
987 | + import openerp |
988 | + from openerp import release |
989 | + from openerp import report |
990 | + from openerp.osv import orm, osv, fields |
991 | + from openerp import jasper_report |
992 | + from openerp.tools.translate import _ |
993 | + |
994 | import unicodedata |
995 | from xml.dom.minidom import getDOMImplementation |
996 | |
997 | -src_chars = """ '"()/*-+?¿!&$[]{}@#`'^:;<>=~%,\\""" |
998 | +src_chars = """ '"()/*-+?¿!&$[]{}@#`'^:;<>=~%,\\""" |
999 | src_chars = unicode( src_chars, 'iso-8859-1' ) |
1000 | dst_chars = """________________________________""" |
1001 | dst_chars = unicode( dst_chars, 'iso-8859-1' ) |
1002 | @@ -189,7 +192,7 @@ |
1003 | model = pool.get(modelName) |
1004 | fields = model._columns.keys() |
1005 | fields += model._inherit_fields.keys() |
1006 | - # Remove duplicates because model may have fields with the |
1007 | + # Remove duplicates because model may have fields with the |
1008 | # same name as it's parent |
1009 | fields = sorted( list( set( fields ) ) ) |
1010 | for field in fields: |
1011 | @@ -227,7 +230,7 @@ |
1012 | newName = model._inherit_fields[field][2]._obj |
1013 | self.generate_xml(cr, uid, context, pool, newName, fieldNode, document, depth-1, False) |
1014 | continue |
1015 | - |
1016 | + |
1017 | if fieldType == 'float': |
1018 | value = '12345.67' |
1019 | elif fieldType == 'integer': |
1020 | @@ -246,18 +249,18 @@ |
1021 | |
1022 | if depth > 1 and modelName != 'Attachments': |
1023 | # Create relation with attachments |
1024 | - fieldNode = document.createElement( '%s-Attachments' % _('Attachments') ) |
1025 | + fieldNode = document.createElement( '%s-Attachments' % self.unaccent(_('Attachments')) ) |
1026 | parentNode.appendChild( fieldNode ) |
1027 | self.generate_xml(cr, uid, context, pool, 'ir.attachment', fieldNode, document, depth-1, False) |
1028 | |
1029 | if first_call: |
1030 | # Create relation with user |
1031 | - fieldNode = document.createElement( '%s-User' % _('User') ) |
1032 | + fieldNode = document.createElement( '%s-User' % self.unaccent(_('User')) ) |
1033 | parentNode.appendChild( fieldNode ) |
1034 | self.generate_xml(cr, uid, context, pool, 'res.users', fieldNode, document, depth-1, False) |
1035 | |
1036 | # Create special entries |
1037 | - fieldNode = document.createElement( '%s-Special' % _('Special') ) |
1038 | + fieldNode = document.createElement( '%s-Special' % self.unaccent(_('Special')) ) |
1039 | parentNode.appendChild( fieldNode ) |
1040 | |
1041 | newNode = document.createElement('copy') |
1042 | |
1043 | === added directory 'jasper_reports/static' |
1044 | === added directory 'jasper_reports/static/src' |
1045 | === added directory 'jasper_reports/static/src/img' |
1046 | === added file 'jasper_reports/static/src/img/icon.png' |
1047 | Binary files jasper_reports/static/src/img/icon.png 1970-01-01 00:00:00 +0000 and jasper_reports/static/src/img/icon.png 2013-06-10 04:30:42 +0000 differ |
1048 | === modified file 'jasper_reports/wizard/__init__.py' |
1049 | --- jasper_reports/wizard/__init__.py 2009-01-03 20:36:32 +0000 |
1050 | +++ jasper_reports/wizard/__init__.py 2013-06-10 04:30:42 +0000 |
1051 | @@ -1,1 +1,1 @@ |
1052 | -import create_data_template |
1053 | +import jasper_create_data_template |
1054 | |
1055 | === removed file 'jasper_reports/wizard/create_data_template.py' |
1056 | --- jasper_reports/wizard/create_data_template.py 2011-06-13 15:17:43 +0000 |
1057 | +++ jasper_reports/wizard/create_data_template.py 1970-01-01 00:00:00 +0000 |
1058 | @@ -1,81 +0,0 @@ |
1059 | -# encoding: iso-8859-15 |
1060 | -import wizard |
1061 | -import pooler |
1062 | -import base64 |
1063 | -import osv |
1064 | -from tools.translate import _ |
1065 | - |
1066 | -view_form_start = """<?xml version="1.0"?> |
1067 | - <form string="Create Data Template"> |
1068 | - <group colspan="2"> |
1069 | - <field name="model"/> |
1070 | - <field name="depth"/> |
1071 | - </group> |
1072 | - </form>""" |
1073 | - |
1074 | -view_fields_start = { |
1075 | - 'model': { 'string': 'Model', 'type': 'many2one', 'relation': 'ir.model', 'required': True }, |
1076 | - 'depth': { 'string':'Depth', 'type':'integer', 'required': True }, |
1077 | -} |
1078 | - |
1079 | -view_form_end = """<?xml version="1.0"?> |
1080 | - <form string="Create Data Template"> |
1081 | - <group colspan="2"> |
1082 | - <field name="model"/> |
1083 | - <field name="data" filename="filename"/> |
1084 | - <field name="filename" invisible="1"/> |
1085 | - </group> |
1086 | - </form>""" |
1087 | - |
1088 | -view_fields_end = { |
1089 | - 'model': { 'string': 'Model', 'type': 'char', 'readonly': True }, |
1090 | - 'data': { 'string': 'XML', 'type': 'binary', 'relation': 'ir.model', 'readonly': True }, |
1091 | - 'filename': { 'string': 'File Name', 'type': 'char' }, |
1092 | -} |
1093 | - |
1094 | -class create_data_template(wizard.interface): |
1095 | - |
1096 | - def _action_start(self, cr, uid, data, context): |
1097 | - res = { |
1098 | - 'depth': 1 |
1099 | - } |
1100 | - return res |
1101 | - |
1102 | - def _action_create_xml(self, cr, uid, data, context): |
1103 | - pool = pooler.get_pool(cr.dbname) |
1104 | - form = data['form'] |
1105 | - values = pool.get('ir.model').read(cr, uid, form['model'], ['name','model'], context) |
1106 | - name = values['name'] |
1107 | - model = values['model'] |
1108 | - |
1109 | - |
1110 | - xml = pool.get('ir.actions.report.xml').create_xml(cr, uid, model, form['depth'], context) |
1111 | - |
1112 | - return { |
1113 | - 'model': name, |
1114 | - 'data': base64.encodestring( xml ), |
1115 | - 'filename': 'jasper.xml', |
1116 | - } |
1117 | - |
1118 | - states = { |
1119 | - 'init': { |
1120 | - 'actions': [_action_start], |
1121 | - 'result': { |
1122 | - 'type': 'form', |
1123 | - 'arch': view_form_start, |
1124 | - 'fields': view_fields_start, |
1125 | - 'state': [('end','Cancel','gtk-cancel'),('create','Create','gtk-ok')] |
1126 | - } |
1127 | - }, |
1128 | - 'create': { |
1129 | - 'actions': [_action_create_xml], |
1130 | - 'result': { |
1131 | - 'type': 'form', |
1132 | - 'arch': view_form_end, |
1133 | - 'fields': view_fields_end, |
1134 | - 'state': [('end','Accept','gtk-ok')] |
1135 | - } |
1136 | - } |
1137 | - } |
1138 | - |
1139 | -create_data_template('jasper_create_data_template') |
1140 | |
1141 | === added file 'jasper_reports/wizard/jasper_create_data_template.py' |
1142 | --- jasper_reports/wizard/jasper_create_data_template.py 1970-01-01 00:00:00 +0000 |
1143 | +++ jasper_reports/wizard/jasper_create_data_template.py 2013-06-10 04:30:42 +0000 |
1144 | @@ -0,0 +1,70 @@ |
1145 | +# -*- encoding: utf-8 -*- |
1146 | +############################################################################## |
1147 | +# |
1148 | +# Copyright (c) 2012 Omar Castiñeira Saavedra <omar@pexego.es> |
1149 | +# Pexego Sistemas Informáticos http://www.pexego.es |
1150 | +# Copyright (C) 2013 Tadeus Prastowo <tadeus.prastowo@infi-nity.com> |
1151 | +# Vikasa Infinity Anugrah <http://www.infi-nity.com> |
1152 | +# |
1153 | +# WARNING: This program as such is intended to be used by professional |
1154 | +# programmers who take the whole responsability of assessing all potential |
1155 | +# consequences resulting from its eventual inadequacies and bugs |
1156 | +# End users who are looking for a ready-to-use solution with commercial |
1157 | +# garantees and support are strongly adviced to contract a Free Software |
1158 | +# Service Company |
1159 | +# |
1160 | +# This program is Free Software; you can redistribute it and/or |
1161 | +# modify it under the terms of the GNU General Public License |
1162 | +# as published by the Free Software Foundation; either version 2 |
1163 | +# of the License, or (at your option) any later version. |
1164 | +# |
1165 | +# This program is distributed in the hope that it will be useful, |
1166 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1167 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1168 | +# GNU General Public License for more details. |
1169 | +# |
1170 | +# You should have received a copy of the GNU General Public License |
1171 | +# along with this program; if not, write to the Free Software |
1172 | +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
1173 | +# |
1174 | +############################################################################## |
1175 | + |
1176 | +import base64 |
1177 | + |
1178 | +try: |
1179 | + import release |
1180 | + import pooler |
1181 | + from osv import osv,fields |
1182 | + from tools.translate import _ |
1183 | +except ImportError: |
1184 | + import openerp |
1185 | + from openerp import release |
1186 | + from openerp import pooler |
1187 | + from openerp.osv import osv,fields |
1188 | + from openerp.tools.translate import _ |
1189 | + |
1190 | +class create_data_template(osv.osv_memory): |
1191 | + _name = 'jasper.create.data.template' |
1192 | + _description = 'Create data template' |
1193 | + |
1194 | + def action_create_xml(self, cr, uid, ids, context=None): |
1195 | + for data in self.read(cr, uid, ids, context=context): |
1196 | + model = self.pool.get('ir.model').browse(cr, uid, data['model'][0], context=context) |
1197 | + xml = self.pool.get('ir.actions.report.xml').create_xml(cr, uid, model.model, data['depth'], context) |
1198 | + self.write(cr,uid,ids,{ |
1199 | + 'data' : base64.encodestring( xml ), |
1200 | + 'filename': 'template.xml' |
1201 | + }) |
1202 | + return True |
1203 | + |
1204 | + _columns = { |
1205 | + 'model': fields.many2one('ir.model', 'Model', required=True), |
1206 | + 'depth': fields.integer("Depth", required=True), |
1207 | + 'filename': fields.char('File Name', size=32), |
1208 | + 'data': fields.binary('XML') |
1209 | + } |
1210 | + |
1211 | + _defaults = { |
1212 | + 'depth': 1 |
1213 | + } |
1214 | +create_data_template() |
1215 | |
1216 | === added file 'jasper_reports/wizard/jasper_create_data_template.xml' |
1217 | --- jasper_reports/wizard/jasper_create_data_template.xml 1970-01-01 00:00:00 +0000 |
1218 | +++ jasper_reports/wizard/jasper_create_data_template.xml 2013-06-10 04:30:42 +0000 |
1219 | @@ -0,0 +1,36 @@ |
1220 | +<?xml version="1.0" encoding="utf-8"?> |
1221 | +<openerp> |
1222 | + <data> |
1223 | + <record id="view_pos_box_out" model="ir.ui.view"> |
1224 | + <field name="name">Create Data Template</field> |
1225 | + <field name="model">jasper.create.data.template</field> |
1226 | + <field name="type">form</field> |
1227 | + <field name="arch" type="xml"> |
1228 | + <form string="Create Data Template"> |
1229 | + <group colspan="2"> |
1230 | + <field name="model"/> |
1231 | + <field name="depth"/> |
1232 | + <field name="data" filename="filename" readonly="1" /> |
1233 | + <field name="filename" invisible="1"/> |
1234 | + </group> |
1235 | + <group colspan="4" col="4"> |
1236 | + <group col="2" colspan="2"/> |
1237 | + <button name="action_create_xml" string="Create" |
1238 | + colspan="1" type="object" icon="gtk-apply" /> |
1239 | + <button icon="gtk-stop" special="cancel" |
1240 | + string="Close" /> |
1241 | + </group> |
1242 | + </form> |
1243 | + </field> |
1244 | + </record> |
1245 | + |
1246 | + <record id="action_jasper_create_date_template" model="ir.actions.act_window"> |
1247 | + <field name="name">Create Data Template</field> |
1248 | + <field name="type">ir.actions.act_window</field> |
1249 | + <field name="res_model">jasper.create.data.template</field> |
1250 | + <field name="view_type">form</field> |
1251 | + <field name="view_mode">form</field> |
1252 | + <field name="target">new</field> |
1253 | + </record> |
1254 | + </data> |
1255 | +</openerp> |
1256 | \ No newline at end of file |