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>&#91;&#91; 
setTag&#40;'para','image',&#123;'width'&#58;'480.0','height'&#58;'480.0'&#125;&#41;
 &#93;&#93;&#91;&#91; line.product_id.image or setTag&#40;'image','para'&#41; 
&#93;&#93;</para>

But OpenERP throws me this error:

Traceback &#40;most recent call last&#41;&#58;
&nbsp; File "service\web_services.pyo", line 630, in go
&nbsp; File "report\report_sxw.pyo", line 374, in create
&nbsp; File "report\report_sxw.pyo", line 431, in create_source_pdf
&nbsp; File "report\report_sxw.pyo", line 441, in create_single_pdf
&nbsp; File "report\preprocess.pyo", line 56, in preprocess_rml
&nbsp; File "report\preprocess.pyo", line 56, in preprocess_rml
&nbsp; File "report\preprocess.pyo", line 56, in preprocess_rml
&nbsp; File "report\preprocess.pyo", line 56, in preprocess_rml
&nbsp; File "report\preprocess.pyo", line 56, in preprocess_rml
&nbsp; File "report\preprocess.pyo", line 54, in preprocess_rml
&nbsp; File "report\preprocess.pyo", line 20, in _sub3
AttributeError&#58; 'NoneType' object has no attribute 'tag'

The workaround to this is by changing the code to:

<para>&#91;&#91; 
setTag&#40;'para','image',&#123;'width'&#58;'480.0','height'&#58;'480.0'&#125;&#41;
 &#93;&#93;&#91;&#91; line.product_id.image or '' &#93;&#93;</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>&#91;&#91; 
setTag&#40;'para','image',&#123;'width'&#58;'480.0','height'&#58;'480.0'&#125;&#41;
 &#93;&#93;&#91;&#91; line.product_id.image or removeParentNode&#40;'para'&#41; 
&#93;&#93;</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

Reply via email to