Contributors mailing list archives

contributors@odoo-community.org

Browse archives

Avatar

Re: Aeroo replacement and text2text reporting engine

by
Alexinux, Alexis de Lattre
- 08/12/2016 10:52:02


2016-12-07 18:53 GMT+01:00 Holger Brunn <hbrunn@therp.nl>:
> Do you know an equivalent module that supports txt  txt reports ? If
> not, I think it would be great to develop one in the OCA, don't you think ?

qweb. Most people are not aware that it's not limited to xml, you can
generate arbitrary text with it. See runbot for an example:
https://github.com/odoo/odoo-extra/blob/master/runbot/runbot.xml#L660

Thanks for this info, it's very interesting ! As far as I understand, qweb supports txt2txt reports, but this is not supported by the reporting engine of Odoo using the ir.actions.report.xml object, cf :
- https://github.com/odoo/odoo/blob/10.0/odoo/addons/base/ir/ir_actions.py#L87  => report_type field only has "qweb-pdf" and "qweb-html"
- https://github.com/odoo/odoo/blob/10.0/addons/report/models/report.py#L486 => in the method _get_report_from_name(), it also filters on "qweb-pdf" and "qweb-html"

But I confirm that simple text templating works with qweb ; I ported my module purchase_dilicom_csv using it :
https://github.com/akretion/dilicom/tree/10.0/purchase_dilicom_csv
but, compared to my v8 version with Aeroo, it needs extra work :
- add a button by inheriting the purchase.order form view
- add the python code corresponding to that button that calls the render method on the qweb template and create an attachement to allow the user to download the file (I don't know an easier way to throw a file to the user without going through a "real" report).

So maybe we would develop a small OCA module to add a "qweb-txt" as an additionnal report_type and have support for it in ir.actions.report.xml. Do you think it would be possible ? easy to do ?

--
Alexis de Lattre
Akretion France - 35B rue Montgolfier - 69100 Villeurbanne - France
Mail : alexis.delattre@akretion.com

Reference