When I generate a sale I usually print a document so that the driver has a reference of the address, we still file orders in physical form and I need the information that is printed to include my client's contact number. How do I include it in the pdf report?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
Hi,
To display the customers phone number in the sale order PDF report, either you can do it by inheriting the existing report and add the phone number or you can do it by editing the existing template from the user interface. The first one will be recommended.
To do it by inheriting as a custom module, for inheriting an existing report, you can check this documentation : Inheriting and modifying QWeb reports
In your case your inherited code will be like this:
<template id="report_saleorder_document_inherit_phone_number" inherit_id="sale.report_saleorder_document"> |
<xpath expr="//div[@name='payment_term']" position="after"> |
<div class="col-3" t-if="doc.partner_id.phone"> |
<strong>Customer Phone:</strong> |
<p t-esc="doc.partner_id.phone"/> |
</div> |
</xpath> |
The above code will add the customers phone number after the Payment terms in the report, in the Xpath in the above code you can see that the position given for the phone number is after the payment terms. You can change it as per the need. You can create a custom module and add the above code.
For doing the same from the user interface activate the developer mode and navigate to Settings -> Technical -> Reporting -> Reports , then search for the report of the sale order, open it and click the Qweb View smart button in the top right of the form, here you will see the record of the corresponding report as well as its inherited reports. Now you can open the document named report_saleorder_document and add the below line to the Architecture page at the needed position.
<div class="col-3" t-if="doc.partner_id.phone"> |
<strong>Customer Phone:</strong> |
<p t-esc="doc.partner_id.phone"/> </div> |
This will display the phone number recorded inside the Customer form in the Phone field.
Thanks
Thank you very much for your help, it worked perfectly, although I was a bit afraid to move parameters from the developer mode, the explanation was incredibly accurate, thank you.
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
0
Aug 17
|
3221 | ||
|
2
Dec 24
|
118 | ||
|
2
Nov 24
|
16373 | ||
|
2
Nov 24
|
477 | ||
|
2
Oct 24
|
262 |