Hi folks
I have encountered several problems when adding images into reports.
Problem #1
I have learnt from searching the forum that to add images, the following code
can be used:
<para>[[
setTag('para','image',{'width':'480.0','height':'480.0'})
]][[ line.product_id.image or setTag('image','para')
]]</para>
But OpenERP throws me this error:
Traceback (most recent call last):
File "service\web_services.pyo", line 630, in go
File "report\report_sxw.pyo", line 374, in create
File "report\report_sxw.pyo", line 431, in create_source_pdf
File "report\report_sxw.pyo", line 441, in create_single_pdf
File "report\preprocess.pyo", line 56, in preprocess_rml
File "report\preprocess.pyo", line 56, in preprocess_rml
File "report\preprocess.pyo", line 56, in preprocess_rml
File "report\preprocess.pyo", line 56, in preprocess_rml
File "report\preprocess.pyo", line 56, in preprocess_rml
File "report\preprocess.pyo", line 54, in preprocess_rml
File "report\preprocess.pyo", line 20, in _sub3
AttributeError: 'NoneType' object has no attribute 'tag'
The workaround to this is by changing the code to:
<para>[[
setTag('para','image',{'width':'480.0','height':'480.0'})
]][[ line.product_id.image or '' ]]</para>
The problem with this is now the image MUST exist for the report to be
generated, which is not desirable. Why isn't setTag working now? I've also
tried with this to no avail, it gives a blank:
<para>[[
setTag('para','image',{'width':'480.0','height':'480.0'})
]][[ line.product_id.image or removeParentNode('para')
]]</para>
Problem #2
So even if I could get the images into the report, OpenERP ignores the aspect
ratio of the image. If I have {'width':'480.0','height':'480.0'} in the image
tag, the image comes out as a square, regardless of the original dimensions.
This could be bad if the report is image-intensive and the accuracy of the
images is important. Hence I would like to know how it would be possible to
maintain the aspect ratio of the images in reports? Perhaps it would be better
to supply maxHeight and maxWidth parameters instead of fixed height and width.
Thank you in advance to anyone who can help me solve these problems.
Regards,
Stanley
-------------------- m2f --------------------
--
http://www.openobject.com/forum/viewtopic.php?p=38095#38095
-------------------- m2f --------------------
_______________________________________________
Tinyerp-users mailing list
http://tiny.be/mailman2/listinfo/tinyerp-users