LocalService "create" method crashes when called with a txt report
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Server (MOVED TO GITHUB) |
Confirmed
|
Medium
|
OpenERP Publisher's Warranty Team |
Bug Description
Hi,
I've just updated OpenERP Client and OpenERP Server to revno 3518 and some TXT reports begun to fail. It returns False when it creates the service.
The error seems to be on server/
<code>
1 === modified file 'bin/report/
2 --- bin/report/
3 +++ bin/report/
4 @@ -118,7 +118,7 @@
5 def draw(self):
6 self.canv.
7 self.canv.
8 - self.canv.
9 + self.canv.
10 self.canv.endForm()
11
12 class PageReset(
13
14 === modified file 'bin/report/
15 --- bin/report/
16 +++ bin/report/
17 @@ -434,9 +434,9 @@
18 context={}
19 pool = pooler.
20 attach = report_
21 + results = []
22 if attach:
23 objs = self.getObjects(cr, uid, ids, context)
24 - results = []
25 for obj in objs:
26 aname = eval(attach, {'object':obj, 'time':time})
27 result = False
28 @@ -467,18 +467,24 @@
29 #TODO: should probably raise a proper osv_except instead, shouldn't we? see LP bug #325632
30 logging.
31 results.
32 - if results:
33 - if results[
34 - from pyPdf import PdfFileWriter, PdfFileReader
35 - output = PdfFileWriter()
36 - for r in results:
37 - reader = PdfFileReader(
38 - for page in range(reader.
39 - output.
40 - s = cStringIO.
41 - output.write(s)
42 - return s.getvalue(), results[0][1]
43 - return self.create_
44 + else:
45 + for id in ids:
46 + result = self.create_
47 + if not result:
48 + return False
49 + results.
50 + if results:
51 + if results[0][1] == 'pdf':
52 + from pyPdf import PdfFileWriter, PdfFileReader
53 + output = PdfFileWriter()
54 + for r in results:
55 + reader = PdfFileReader(
56 + for page in range(reader.
57 + output.
58 + s = cStringIO.
59 + output.write(s)
60 + return s.getvalue(), results[0][1]
61 + return False
62
63 def create_
64 if not context:
65
</code>
If we see the difference between the added line on line 61 and the removed line on line 43, it seems to be returning False when the report type is not "pdf", which is contradictory because this chunk of code is on method create_
However, the solution should be just changing the "return False" statement on line 61 for the return statement on line 43. I'm proposing a patch to be evaluated. With this patch, everything should be working again as pretty as always
Greets from Caracas - Venezuela
Israel Fermín Montilla.
Changed in openobject-server: | |
assignee: | nobody → OpenERP's Framework R&D (openerp-dev-framework) |
M110412162-eyqmhncr