Print Engine is broken Converting to other type that is not PDF or HTML

Bug #510834 reported by Nhomar - Vauxoo
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Invalid
Wishlist
Unassigned

Bug Description

Crating reports and selecting odt file extension to ou give me an exception!

Menu > Administration > Low Level Objects > Actions > Report XML

Search with the Object File : "Invoice"

Edit this element and change the value that Say PDF for ODT.

Traceback (most recent call last):
  File "/home/nhomar/openerp/stable/5.0/instancias/ingelub/server/bin/service/web_services.py", line 703, in go
    (result, format) = obj.create(cr, uid, ids, datas, context)
  File "/home/nhomar/openerp/stable/5.0/instancias/ingelub/server/bin/report/report_sxw.py", line 364, in create
    fnct_ret = fnct(cr, uid, ids, data, report_xml, context)
  File "/home/nhomar/openerp/stable/5.0/instancias/ingelub/server/bin/report/report_sxw.py", line 370, in create_source_odt
    return self.create_single_odt(cr, uid, ids, data, report_xml, context or {})
  File "/home/nhomar/openerp/stable/5.0/instancias/ingelub/server/bin/report/report_sxw.py", line 518, in create_single_odt
    rml_dom = self.preprocess_rml(rml_dom,report_type)
  File "/home/nhomar/openerp/stable/5.0/instancias/ingelub/server/bin/report/preprocess.py", line 59, in preprocess_rml
    self.preprocess_rml(node,type)
  File "/home/nhomar/openerp/stable/5.0/instancias/ingelub/server/bin/report/preprocess.py", line 54, in preprocess_rml
    t = _regex1.sub(_sub1, node.text)
  File "/home/nhomar/openerp/stable/5.0/instancias/ingelub/server/bin/report/preprocess.py", line 50, in _sub1
    while n.tag not in match:
AttributeError: 'NoneType' object has no attribute 'tag'

Edit The Element Again and put HTML

The result if the field are not in a setion this are not located and the printing is directly with the names of variables.

THIS HAPPEND on web-client ando with gtk-client.

I have resources to work in repair it, some body can explain in few words how is the logic in the printing system ¡¡¡¡please!!!!, ¿where are the scripts and the converters? because we had worked on it and We didn't found this characteristic in all the source code, debug the printing behaviour is a COMPLETE MISTERY.

Thanks.

Related branches

Revision history for this message
Borja López Soilán (NeoPolus) (borjals) wrote :

Hi Nhomar.

Take a look at the code in "bin/report/report_sxw.py" (/home/nhomar/openerp/stable/5.0/instancias/ingelub/server/bin/report/report_sxw.py), it is there where the creation of ODT or HTML files is done.

The report engine, currently is mostly an XML parser that reads RML files (based on ReportLab:http://www.reportlab.com/software/opensource/ though not all features are supported: https://bugs.launchpad.net/openobject-server/+bug/509266) and either writes a transformed XML file like a HTML or ODT file (after all ODT files are compressed zip archives with several xml files inside), or writes a PDF file in a similar way to ReportLab. In the "bin/report/render" you can find the code that does the XML transformation.

Some people have extended the parser with modules, so it can:
 - Process jasper reports files (using Jasper Reports engine). Take a look at the server modules in https://launchpad.net/openobject-client-kde
 - Process OpenOffice files directly (no RML step) and output ODT or PDF files. Take a look at https://launchpad.net/report-openoffice
 - Even we, at Pexego, developed our own OpenOffice module (it hasn't been released yet, as we are considering merging with the previous addon) that can read any format supported by OpenOffice and write any format supported by OpenOffice (you can do ODT to PDF, but you can also have an ODS template that output XLS files, or a RTF template that outputs DOC files...), and even supports subreports [But this engine has a 'problem' that the previous one does not: it requires OpenOffice to be installed on the server]

Revision history for this message
Dhara Shah (OpenERP) (dsh-openerp) wrote :

Hi Nhomar.

The invoice report file is in sxw format and thus when you change report type from pdf to sxw,you will get report correctly but not for odt.
I'll surely get back to you with odt report soon .

I have not checked for HTML yet but can you provide some more details? ..

Hi Borja,

Yes the problem is around those zip archives but I think it will be done .Currently I am getting inovice odt report correctly but the mime type is of sxw :(.

Thanks,
Dhara

Changed in openobject-server:
importance: Undecided → High
milestone: none → 5.0.9
status: New → Confirmed
Revision history for this message
Dhara Shah (OpenERP) (dsh-openerp) wrote :

Hello ,

I am really sorry for taking so much time to reply.
Actually,I was waiting for confirmations.Still there is confusion for using headless -open office thing or not ,which help to change file from sxw to odt and odt to sxw.

But,here is the patch which will solve server crash problem.Limitation of this patch is :::
'No matter if one will select "odt" report type,person will get final report in "sxw" as original report file(we have two kind of files 1)sxw/odt 2) rml of that report - example order report of sale) is in "sxw" and vice-versa.

Thanks,
Dhara Shah.

Changed in openobject-server:
milestone: 5.0.9 → 5.0.10
Changed in openobject-server:
milestone: 5.0.10 → 5.0.11
Changed in openobject-server:
milestone: 5.0.11 → 5.0.12
Revision history for this message
Marcel van der Boom (HS-Development BV) (mrb) wrote :

This looks to me like a regression of bug https://bugs.launchpad.net/openobject-server/+bug/392480 ? Depending on the rml I think the test for 'None' on the n.getparent() calls.

We got a very similar error, which we were able to work around with:

--- bin/report/preprocess.py 2010-04-23 14:12:24 +0000
+++ bin/report/preprocess.py 2010-07-20 10:31:51 +0000
@@ -19,6 +19,8 @@
                 def _sub3(txt):
                     n = node
                     while n.tag != txt.group(2):
+ if n.getparent() is None:
+ break
                         n = n.getparent()
                     n.set('rml_tag

I suspect this bug can be worked around in the same manner

Revision history for this message
Christophe Combelles (ccomb) wrote :

Just encountered this exact bug 30min after installing 5.0.15...

Changed in openobject-server:
milestone: 5.0.12 → 5.0.15
Revision history for this message
Christophe Combelles (ccomb) wrote :

I don't know how the report engine works, but I've tried to dig.

The fix in comment #4 doesn't work.

The n.getparent() loop always reaches the top node (which in None), because the n.tag is never found in odt_parents.
The n.tag is never found in odt_parents because the nodes are not ODT nodes, but SXW nodes!

As a consequence, if I replace match = odt_parents with match = sxw_parents, I don't get an error, but the file is not filled with data. (we still see the directives as in the RML file).
So there is something wrong with the originating root_node, which is of the wrong type.

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Hello,

I'm invalidating this bug because regardless of the features of the reporting engine, you're not supposed to change the types of reports installed by default on the system.
In fact with 6.0 the report type is not a selection field anymore but a character field, and the list of Reports is hidden even from Admins by default to avoid this kind of mistake.

Report entries are internal resources created by modules, which end users (even administrators) are not supposed to alter.
This is certainly not a High issue, because you are messing up with internal OpenERP structures.

If you are developing your own modules and need more details on the reporting engine don't hesitate to discuss on the forum/mailing-list or ask questions using the Questions interface.

Thanks!

Changed in openobject-server:
importance: High → Wishlist
milestone: 5.0.15 → none
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.