Skip to Content
Menu
This question has been flagged
2 Replies
55 Views

Hello,


If I set up a customer via Contacts and add a reference under Sales & Purchasing -> Other, why is this reference number not displayed in a sales order?


When I create a new sales order via the "Sale" button, the reference number is not carried over to the sales order.


I would love to have a customer number that can be displayed on a sales order and an invoice.


Can someone help?


We are currently using Odoo v17 Community Edition, self-hosted.

Avatar
Discard
Author

Hello Abdoul,

this helps a lot.
Your steps are working perfectly.

Now I will try to add this field to the pdf.
I wrote an own template for sales orders and invoice's, so this must work ;-)

Author Best Answer

For those, having the same point.

I added the new parameter to my template via

<div class="col-6">Customer number:</div>

    <div class="col-6"><span t-field="o.x_customernr"/></div>

</div>

Avatar
Discard
Best Answer

Hi,

By default, when you set a reference for a customer in the Contacts module under Sales & Purchases, this reference does not automatically appear in the quotation creation form.

If you want to display this field, you need to enable developer mode and manually add it to the quotation and invoice forms.

Steps to follow:

  1. Enable developer mode.
  2. Open the Quotation or Invoice model, then click on the bug icon (edit mode).
  3. Click on the "View Fields" menu.
  4. Create a "Customer Reference" field, which should be a related field linked to the contact.
  5. After creating the field, go back to edit mode by clicking the bug icon again, then select "Edit View: Form".
  6. Instead of modifying the main view directly, create an inherited view. This is important because any direct modification to the main view will be lost after an update.
  7. In the Architecture section of the inherited view, you can use the sample code I provided in the screenshots. However, in the field name, you will need to enter the technical name of your custom field.

I will illustrate these steps with screenshots to make them clearer.

However, even after this modification, the reference will only appear in the quotation and invoice forms. If you also want it to be displayed on the generated PDF documents (quotation and invoice), you will need to modify the corresponding reports to include this field.

Hope this helps!

Avatar
Discard