Skip to Content
Menu
This question has been flagged
6 Replies
4892 Views

I have a custom field "x_RDHeight" in Sales-> product module. I need to print that value in the Sales->Quotations while printing the quotations in the PDF

I need to print the product along with the description while doing the configurations it is giving the exceptions.

Exception:-

QWebException: "description" while evaluating

"translate_doc(doc_id, doc_model, 'partner_id.lang', 'sale.report_saleorder_document')"

Avatar
Discard
Author

while Doing the below configuration Iam getting those exceptions QWebException: "description" while evaluating "translate_doc(doc_id, doc_model, 'partner_id.lang', 'sale.report_saleorder_document')"

Best Answer

Hi Sudarsan,

You should edit the file report_saleorder.xml under addons/sale/views.
In this file is a part that loops over every product you've added on your quotation / sale order. Which looks like this:

 <tbody class="sale_tbody">
                    <tr t-foreach="o.order_line" t-as="l">
                        <td>
                           <span t-field="l.name"/>
                        </td>
                        <td>
                            <span t-esc="', '.join(map(lambda x: x.name, l.tax_id))"/>
                        </td>
                        <td class="text-right">
                            <span t-field="l.product_uom_qty"/>
                            <span groups="product.group_uom" t-field="l.product_uom"/>
                        </td>
                        <td class="text-right">
                            <span t-field="l.price_unit"/>
                        </td>
                        <td groups="sale.group_discount_per_so_line">
                            <span t-field="l.discount"/>
                        </td>
                        <td class="text-right">
                            <span t-field="l.price_subtotal"
                                t-field-options='{"widget": "monetary", "display_currency": "o.pricelist_id.currency_id"}'/>
                        </td>
                    </tr>
                </tbody>
            </table>

As you can see you can access any field from the product here (as long as its within the foreach), so simply add yours where you want it. Add the following line:

 <span t-field="l.x_RDHeigh"/> 

It should then be printed on your report.

Best of luck,
Yenthe

Avatar
Discard
Author Best Answer

Hi Yenthe,

The change is not effecting in My Local Odoo, Is there any other thing to do along with that.



Avatar
Discard

Use nano, pico, vim editors to open the file and edit.

The file report_saleorder.xml is under addons/sale/views.

Have you reloaded your module? You always need to reload your module first.

Best Answer

Here is an example with a new module redefining existing report template :

<template id="sale_report_delivery_date" name="Delivery Date on Sale Report" inherit_id="sale.report_saleorder_document"> 
<xpath expr="//div[@id='informations']" position="inside">
<div t-if="o.requested_delivery_datetime_start" class="col-xs-3">
<strong>Delivery interval : from </strong>
<p t-field="o.requested_delivery_datetime_"/>
</div>
</xpath>
</template>

Avatar
Discard
Best Answer

Sudarsan,

There is also a video to help you out.

Thanks.

Avatar
Discard