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.

0

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

By
Lerner
on 6/25/15, 5:45 AM 830 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

--Yenthe--
6716
| 7 7 8
Turnhout, Belgium
--Yenthe--

My Odoo blog: http://www.odoo.yenthevg.com/

My Twitter: https://twitter.com/Yenthe666

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

Serpent Consulting Services Pvt. Ltd.

--Serpent Consulting Services Pvt. Ltd.--
4341
| 6 6 8
Gandhinagar, India
--Serpent Consulting Services Pvt. Ltd.--

Serpent Consulting Services Pvt. Ltd. Your Odoo/OpenERP Solution, just an email away!

Serpent Consulting Services Pvt. Ltd.
On 6/25/15, 7:19 AM

Sudarsan,

There is also a video to help you out.

Thanks.

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: 6/25/15, 5:45 AM
Seen: 830 times
Last updated: 7/6/15, 8:36 AM