Customer PO number on invoice print format

Hi,

Another one :)

In the Invoice Print Format...

How can I add the customer's PO Number as entered in the Sales Order to the invoice item lines. At the moment I have the DN showing, and it looks like I can show the SO, but I need the customer PO from the SO.

Cheers

Paul


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/18eb56ed-869d-4c4f-88be-703e759e1ae8%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
Create a Custom Field for “Customer’s PO NO" inside Sales Invoice with same field name as in Sales Order. Then when you create sales invoice from sales order, PO No will get copied automatically.


On Sep 23, 2014, at 9:27 AM, Paul Dowd <pd...@myzealand.com> wrote:

Hi,

Another one :)

In the Invoice Print Format...

How can I add the customer's PO Number as entered in the Sales Order to the invoice item lines. At the moment I have the DN showing, and it looks like I can show the SO, but I need the customer PO from the SO.

Cheers

Paul


  1. Please be kind and don’t send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/18eb56ed-869d-4c4f-88be-703e759e1ae8%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/6B04CE6A-A73B-4772-BFEC-5DB6B4AFA7C4%40gmail.com.

    For more options, visit https://groups.google.com/d/optout.

Hi Nabin,

It doesn't work so I'm assuming I did something wrong... here is my screenshot of the field I created.

How will this work when we are always creating the Invoice from Delivery Note? Both SO and DN have the same field so I don't see it being a problem. We follow the "Sales Order -> Delivery Note -> Sales Invoice" process.

Thanks

Paul


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/da4179dd-74d4-4b44-a648-e33436173390%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.
Paul you need to add it in the Delivery Note too if you are doing Sales Order -> Delivery Note -> Sales Invoice


On 25-Sep-2014, at 4:14 am, Paul Dowd <pd...@myzealand.com> wrote:

Hi Nabin,

It doesn't work so I'm assuming I did something wrong... here is my screenshot of the field I created.

How will this work when we are always creating the Invoice from Delivery Note? Both SO and DN have the same field so I don't see it being a problem. We follow the "Sales Order -> Delivery Note -> Sales Invoice" process.

Thanks

Paul



  1. Please be kind and don’t send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/da4179dd-74d4-4b44-a648-e33436173390%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/3AA53824-E0C8-4616-B40E-DDB5C5E31B3A%40gmail.com.

    For more options, visit https://groups.google.com/d/optout.
Hi Rushabh,

It is in the delivery note as I mentioned. It is not in delivery note items though. Could that be causing the issue? 

Thanks

Paul

On Saturday, 27 September 2014 17:18:52 UTC+12, rushabh wrote:
Paul you need to add it in the Delivery Note too if you are doing Sales Order -> Delivery Note -> Sales Invoice


On 25-Sep-2014, at 4:14 am, Paul Dowd <pd...@myzealand.com> wrote:

Hi Nabin,

It doesn't work so I'm assuming I did something wrong... here is my screenshot of the field I created.

How will this work when we are always creating the Invoice from Delivery Note? Both SO and DN have the same field so I don't see it being a problem. We follow the "Sales Order -> Delivery Note -> Sales Invoice" process.

Thanks

Paul



  1. Please be kind and don’t send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/da4179dd-74d4-4b44-a648-e33436173390%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/1fe79016-fb97-4426-b290-66ac0e190f68%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.

On 30-Sep-2014, at 2:19 am, Paul Dowd <pd...@myzealand.com> wrote:

Hi Rushabh,

It is in the delivery note as I mentioned. It is not in delivery note items though. Could that be causing the issue? 

If its in the Item table in Sales Order, then in needs to be in the Item table in all documents!


Thanks

Paul

On Saturday, 27 September 2014 17:18:52 UTC+12, rushabh wrote:
Paul you need to add it in the Delivery Note too if you are doing Sales Order -> Delivery Note -> Sales Invoice


On 25-Sep-2014, at 4:14 am, Paul Dowd <pd...@myzealand.com> wrote:

Hi Nabin,

It doesn't work so I'm assuming I did something wrong... here is my screenshot of the field I created.

How will this work when we are always creating the Invoice from Delivery Note? Both SO and DN have the same field so I don't see it being a problem. We follow the "Sales Order -> Delivery Note -> Sales Invoice" process.

Thanks

Paul



  1. Please be kind and don’t send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/da4179dd-74d4-4b44-a648-e33436173390%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.



  1. Please be kind and don’t send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/1fe79016-fb97-4426-b290-66ac0e190f68%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/90F234FE-AA36-4821-B57E-0CEA3F16F7DC%40gmail.com.

    For more options, visit https://groups.google.com/d/optout.
OK, so how would I make the po_no in the delivery note in the DN item table equal the po_no in DN?

On Tuesday, 30 September 2014 14:43:43 UTC+13, rushabh wrote:

On 30-Sep-2014, at 2:19 am, Paul Dowd <pd...@myzealand.com> wrote:

Hi Rushabh,

It is in the delivery note as I mentioned. It is not in delivery note items though. Could that be causing the issue? 

If its in the Item table in Sales Order, then in needs to be in the Item table in all documents!


Thanks

Paul

On Saturday, 27 September 2014 17:18:52 UTC+12, rushabh wrote:
Paul you need to add it in the Delivery Note too if you are doing Sales Order -> Delivery Note -> Sales Invoice


On 25-Sep-2014, at 4:14 am, Paul Dowd <pd...@myzealand.com> wrote:

Hi Nabin,

It doesn't work so I'm assuming I did something wrong... here is my screenshot of the field I created.

How will this work when we are always creating the Invoice from Delivery Note? Both SO and DN have the same field so I don't see it being a problem. We follow the "Sales Order -> Delivery Note -> Sales Invoice" process.

Thanks

Paul



  1. Please be kind and don’t send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/da4179dd-74d4-4b44-a648-e33436173390%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.



  1. Please be kind and don’t send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to the Google Groups “ERPNext Developer Forum” group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/1fe79016-fb97-4426-b290-66ac0e190f68%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/16034844-1c59-4c1a-91f1-bdab4461907e%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.

I don't thik the po_no field is in item table of sales order. Please ensure that the fieldname is same for all the documents. it is fieldname, not the field label.

On 30 Sep 2014 08:14, "Paul Dowd" <pd...@myzealand.com> wrote:
OK, so how would I make the po_no in the delivery note in the DN item table equal the po_no in DN?

On Tuesday, 30 September 2014 14:43:43 UTC+13, rushabh wrote:

On 30-Sep-2014, at 2:19 am, Paul Dowd <pd...@myzealand.com> wrote:

Hi Rushabh,

It is in the delivery note as I mentioned. It is not in delivery note items though. Could that be causing the issue?

If its in the Item table in Sales Order, then in needs to be in the Item table in all documents!


Thanks

Paul

On Saturday, 27 September 2014 17:18:52 UTC+12, rushabh wrote:
Paul you need to add it in the Delivery Note too if you are doing Sales Order -> Delivery Note -> Sales Invoice


On 25-Sep-2014, at 4:14 am, Paul Dowd <pd...@myzealand.com> wrote:

Hi Nabin,

It doesn't work so I'm assuming I did something wrong... here is my screenshot of the field I created.

How will this work when we are always creating the Invoice from Delivery Note? Both SO and DN have the same field so I don't see it being a problem. We follow the "Sales Order -> Delivery Note -> Sales Invoice" process.

Thanks

Paul



  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/da4179dd-74d4-4b44-a648-e33436173390%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.



  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/1fe79016-fb97-4426-b290-66ac0e190f68%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/16034844-1c59-4c1a-91f1-bdab4461907e%40googlegroups.com.

    For more options, visit https://groups.google.com/d/optout.


  1. Please be kind and don't send large attachments
  2. For issues, features requests use https://github.com/frappe/erpnext/issues



    You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.

    To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un…@googlegroups.com.

    To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/CA%2BCj7thVXz%2BSKT9SbUrUBSDXK17D2a7HB_3G_b_pc2X03HsxKw%40mail.gmail.com.

    For more options, visit https://groups.google.com/d/optout.

Hi @pdowd

There are 2 options for defining the PO # on the sales invoice.

  1. You can use a po_no field in SO, DN and SI and then when an order comes you mention the po_no in SO which would be taken into a DN and SI. Now the problem with this approach is that if you want to make the Invoice for multiple SO with multiple po_no then in this case that would not be possible. For this you would need to go to next option.
  2. The next option is to add po_no field in the SO Item, DN Item and SI Item table, here you can define a custom script in the Sales Order wherein po_no in SO would be same as in SO item.

We are using the Option 1 in our organisation and make only 1 SI for one po_no, though I know that the second option is much more robost but it would increase the column in sales invoice which is not desirable.

1 Like

Thank you!

I’ve used option 1 for now.

I will implement a custom script in delivery notes to make the DN Item po_no = the DN po_no if I need to use multiple DNs in a Sales Invoice in the future, and therefore need to put it on each item line in the Sales Invoice.

Hi,

I had the same problem,
I have made a custom script that extracts the SO and PO-number for each Sales Invoice Item and places them is a two custom fields instead. This way the table doesn’t becomes so large and I still can use multiple SO to one Invoice.

I’m sure you can edit the script so it will fit your needs.

Br
Jens Bohlin

// DOCTYPE: Sales Invoice
// Client Script
// Author: Jens Bohlin
// Date 2014-05-13
// Script to set the two custom fields: 
//     Sales Order (agg_so) and 
//     Customer's Purchase Order Number (agg_po)
// Note: Sales Order name may not contain ",". (Normally not a problem)


cur_frm.cscript.custom_onload = function(doc) {
	var so_ref = "";
	var po_ref = "";

	$.each(doc.entries, function(i, d) {
		if (d.sales_order) {
			if (so_ref.indexOf(d.sales_order) == -1) {
				if (so_ref) {
					so_ref += ', ';
				}
				so_ref += d.sales_order;
				cur_frm.set_value("agg_so", so_ref);

				frappe.call({
					method: "frappe.client.get_value",
					args: {
						doctype: "Sales Order",
						filters: {
							name: d.sales_order
						},
						fieldname: ["po_no"]
					},
					callback: function(r) {
						console.log(r);
						if (po_ref) {
							po_ref += ', ';
						}
						po_ref += r.message.po_no;
						cur_frm.set_value("agg_po", po_ref);
					}
				});
			}
		}
	});
}

// Update also when page is refreshed....
cur_frm.cscript.custom_refresh = cur_frm.cscript.custom_onload;
1 Like

Hello @adityaduggal,

i am new to erpnext and i was looking the solution for copyng custom field to another doctype, I saw this two options that you wrote. Could you please help me about problem that i have with print format in Sales Invoice.

I Wan’t to create Sales Invoice from multiple delivery notes. I create custom field in delivery note and another in Sales invoice. When i create invoice, erpnext copy only value from last inserted delivery note.
I need to print delivery note custom field to sales invoice print, but he displays only one value. How could i fetch all values from delivery notes.

Thanks in advance