How to add Customer Purchase order number to Sales Invoice

I have created a new print format for Sales Invoice.
I need to add the customer purchase order number to the sales invoice. Without this, many companies will not pay the invoice.

So I can see how to modify the print format and add extra fields, but customer purchase order number is not there.

it is present when creating some forms (e.g sales order) so how can I get it for the sales invoice

BTW I am on ERPNEXT hosted cloud so solution has to be possible from there

ideas?

as far as I know you need a custm script to display existing fields (as you say the “Customer Purchase Number” exists somewhere in the system at other doctypes (Like a Sales invoice).

I am sure I have seen an example posted here on this forum but can’t remember exactly where.
I don’t know whether you can add such a script on a hosted system though

Thanks for the reply, though that is not good news.

it could be the deal breaker for us. Just that one small thing. Most of our trade customers refuse to pay an invoice if it does not contain their purchase order number. I am surprised this has not cropped up before. Surely good practice for any organisation would be to have customer purchase order number on the invoice. If we send 10 invoices to a customer how would they know which is which? :astonished:

Hopefully someone can help me think of a workaround

The easy, if not elegant way to get around it is to create a custom field:

Setup, Customize, Custom Field , Create a new Custom Field, choose Sales Invoice from the Document dropdown, then Edit in fullscreen. Use a label like Customer PO Number and choose whatever options. Check the List box.

Then Setup, Printing, Print Format, click New upper right . Choose Sales Invoice from the Doctype dropdown , Edit. You should be able to add the custom field from the list on the left.

Ideally, you should be able to link the created field with the actual one to avoid duplication. I’m quite new to this so I may be missing another way to add it to Sales Invoice.

So this is the key. I followed your instructions and the new field is available to add to the invoice -but empty. So how to link to the actual data?

I believe you want to link to Customer’s Purchase Order , po_no , field 13 in Sales Order doctype. How to do so I’m not certain but I suspect one of the more knowledgeable people will make quick work of it. Here’s a couple links that may be useful while you wait:

https://www.google.com/search?q=erpnext+link+to+field&ie=utf-8&oe=utf-8

Thanks. checked all that but none the wiser

I can see I need to pull field po_no from the tabSales Order table and insert it into Customise Sales Invoice and then add to the New Sales Invoice print but no idea how, or even if it is possible, But this is essential. Any more ideas?

Hi

As per my understanding of the query:

  1. You have created a new print format for Sales Invoice
  2. You want the Customer PO No to be shown in the Sales Invoice.
  3. You customized the Sales Invoice and added a custom field for Customer PO
  4. The field is added to Sales Invoice but is empty.

As per my knowledge, the name of the new custom field should be same as the corresponding field in Sales Order.

So please make sure the name of your custom field added in Invoice is po_no (the same as that in Sales Order Form).

Hope this solves the issue.

Regards

@rasika25021

Thanks, you have exactly what I am trying to do. But it is not working

This is the field in Sales ORder form

This is what I added in Sales Invoice form

And this shows the field is empty on the invoice

In the Sales Invoice try changing Type to Link and in Options put: Sales Order. See if you get either the PO number in the field when you Get items from the Sales Order , or an error message that has any additional.

@Ron_Taylor

I did exactly the same, added a custom field in Sales Invoice as po_no. So whenever i create a SINV from the SO, its working fine for me.

Just a doubt, are you making the invoice from an SO or DN?

Because in my case, since i dont have the customer PO field added in DN, when i create an invoice from a DN, the corresponding PO field in invoice is blank.

Given that you’re on the cloud solution, I would create two fields. I’m assuming you’re making this invoice manually and not with the make sales invoice button in sales order.

One for a reference to the sales order, so field of type Link with Sales Order in the Options (as @smino mentioned). I would name the field Sales Order. I may also set Print Hide as true if I don’t want it printed.

Then I’d create another field called po_no and make it of type Read Only. And in Options: sales_order.po_no
Selecting a sales order in sales invoice should then fill in the po_no field.

1 Like

Thanks All. It works perfectly when creating the invoice directly from the sales order. So that is great.

Hi, what should be field type for po_no.

Go it thanks

Hi, All.

I have tried the setup as discussed above:

Setup → Customize Form → Sales Invoice → Edit Row:

And make invoice from sales order. It does import the correct PO, but error message shows up each time I try to save the invoice. Is there a step that I missed? Thanks.