Odoo Help

0

How to print the custom field in the Sales->Quotations?

By
Lerner
on 6/25/15, 5:45 AM 1,181 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')"

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')"

Lerner
on 7/6/15, 8:34 AM
2
Yenthe
On 6/25/15, 5:55 AM

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

0
Lerner
On 7/4/15, 2:03 AM

Hi Yenthe,

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



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

Serpent Consulting Services Pvt. Ltd.
on 7/4/15, 3:50 AM

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

Serpent Consulting Services Pvt. Ltd.
on 7/4/15, 3:51 AM

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

Yenthe
on 7/6/15, 9:49 AM
0
David Bertha
On 7/6/15, 5:54 AM

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>

0

Sudarsan,

There is also a video to help you out.

Thanks.

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 6/25/15, 5:45 AM
Seen: 1181 times
Last updated: 7/6/15, 8:36 AM