Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

Adding a product image to Invoice with base_report_designer?

By
Martin Ruf
on 12/5/13, 4:17 PM 3,305 views

Edit: Found This (help.openerp.com/question/9336/how-can-i-add-a-products-image-in-report/): [[ product_id.product_image and setTag('para','image',{'width':'50.0','height':'50.0'}) or removeParentNode('para') ]][[ product_id.product_image ]] Could please someone tell me where i can find the syntax or some manual? Its not working like this. I think i need to somehow query product.product and join it with invoice.line on product_id?! end Edit;

It is possible to do that with the rml files. But is it also possible with the base report designer?

Also good to know: how does the base report designer work server side? Are the reports saved as file or inside the database? Is there a priority?

Other question:

Is there a way to convert SVG to RML? (just for markup) Or to rephrase the question: Are there any other possibilities to to work on the reports, but base_report_designer or rml files directly?

thanks you a lot!

1
Leigh Willard
On 2/13/14, 4:08 PM

I cannot get this to work in the RML for sales orders unless I take it out of the Table that writes the line information.

I think that the table formatting is blocking the image from printing.

Has anyone successfully printed the product image in a sales order line?

Thanks!

I'm also interested in getting this done. I'll post back here when I figure out how to do it. Have you been working with v7 or v8?

Luke Branch
on 7/3/14, 7:21 AM
Luke Branch
on 5/1/15, 10:15 PM
0

Luke Branch

--Luke Branch--
1531
| 6 7 8
Mui Wo, Lantau, Hong Kong
--Luke Branch--

...

Luke Branch
On 7/4/14, 8:18 AM

If you are looking to add a product image to a printed report (ie. PDF or HTML) sales order, purchase order, invoice, or any other report with product order lines I believe I have figured out a solution thanks to Fabrice Henrion's post here: https://www.odoo.com/forum/Help-1/question/Is-there-any-way-to-preview-WebKit-report-layout-while-coding-maybe-WYSIWYG-Editor-52307.

Simply follow Fabrice's instructions as follows (preferably use latest v8 master branch version):

  1. First you have to know that the new QWeb engine allows to output PDF or HTML. It is only when the output is HTML that it can be modified in a WYSIWYG fashion.
  2. Let's assume the Sales module is installed on a fresh Odoo instance. By default, the output of a quotation document is PDF, you can test that by printing a quotation. We want to change this.
  3. Make sure your user has the technical feature checkbox checked. Then go to Settings > Technical > Reports > Reports, then search "sale.order" and enter the record.
  4. Edit the Report Type from PDF to HTML, then Save.
  5. Go back to the Sales app and print a quotation.
  6. A popup appear (or your popup-blocker will notify you). You will see the quotation in that popup and a black bar at the top with the Edit button. You need to make sure you have the access right to edit this so I recommend you do this test as an admin.
  7. From there, it's pretty straightforward. You edit whatever you want. You have to realize that there are 2 types of edition on a record like this: editing this particular record, or editing the quotation template which will have an impact on all records. For example, if you edit a header, it will be a template edition.

If you want to add an image to an order line simply edit the HTML in the HTML editor found in the top navigation menu under Customize >> HTML Editor and find the place in the HTML/QWeb template that you would like to edit. I simply added an extra set of <th></th> tags as follows for a order line header (in the appropriate section of html/qweb that is):

<th class="text-left"><strong>Picture</strong></th>

and then added the following line for the sales order line product picture column:

                                <td class="text-center">
                                   <span t-field="line.product_id.image_small" t-field-options="{&quot;widget&quot;: &quot;image&quot;, &quot;class&quot;: &quot;img-rounded&quot;}"/>
                                </td>

The contents of the <span> tag pull the product image into the sales order line in the column that you want and when you save your html your report will display the appropriate product picture in 64px x 64px.

There may be a better way to do this and I welcome any comments on how this process might be improved.

0
NSC
On 2/14/14, 5:59 AM

Reports transfered by Base Report Designer are stored inside database table ir_act_report_xml to the fields report_rml_content_data (RML) and report_sxw_content_data (SXW). If those fields are empty, report is loaded from external file, otherwise from here.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 12/5/13, 4:17 PM
Seen: 3305 times
Last updated: 4/30/15, 7:29 AM