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 add custom field into the Sales Order PDF Print?

By
Pia
on 10/20/16, 11:33 PM 257 views

version:  Odoo 9

How can I add a custom field into the PDF printable of Sales Order in Odoo?

I created Scheduled delivery date in Database Structure > Model using Developer mode; like this,

Field Name = x_scheduled_date

Field Label = Scheduled Delivery

Field Type = text


It successfully displayed in UI but not in printable version PDF.

How can I simply add this into the PDF please? Next to 'Payment Term' 

Please help me with the exact steps and models needed. 

Thank you very much.

*Moreover, I constantly receive error when trying to edit... report_saleorder_document > Qweb reports in Technical > Reports. One error is: QWebException: 'NoneType' object has no attribute '_fields'

Pia
on 10/20/16, 11:36 PM
1

Bejaoui Souheil

--Bejaoui Souheil--
808
| 2 1 4
Sousse, Tunisia
--Bejaoui Souheil--

Odoo developer,  functional and technical consultant

souheil_bejaoui@hotmail.fr

Bejaoui Souheil
On 10/21/16, 3:46 AM

Hi Pia,

1- After activating the developer mode. Go to settings>Reports

2- Search for template name sale.report_saleorder > Click on Search associated QWeb views

3- Chose sale.report_saleorder_document.

4- Add your field to the report Architecture (here you must do some HTML coding)

If you have trouble to handle this, search for

[...]
<div t-if="doc.date_order" class="col-xs-3">
    <strong t-if="doc.state not in ['draft','sent']">Date Ordered:</strong>
    <strong t-if="doc.state in ['draft','sent']">Quotation Date:</strong>
    <p t-field="doc.date_order"/>
</div>
[...]

past this lines after

<div t-if="doc.user_id.name" class="col-xs-3">                    
    <strong>Scheduled Delivery:</strong>
    <p t-field="doc.x_scheduled_date"/>
</div>

Best regards.

0
Pia
On 10/21/16, 4:37 AM

It work!  You are heaven sent! Thank you very much for your help :) 

Happy to help :)

Bejaoui Souheil
on 10/21/16, 5:25 AM

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: 10/20/16, 11:33 PM
Seen: 257 times
Last updated: 10/21/16, 4:37 AM