Fetch po_no from Sales Order to Production Plan - almost working (?)


First of all thanks to all the developers for an outstanding piece of software. I love it!

What we are trying to achieve is to:

  1. fetch the Customer’s Purchase Order (po_no) from Sales Order
  2. place it in Production Plan Sales Order table

What we did:

  1. create a new custom field (label=“Customer’s Purchase Order”, name=po_no, type=Data) in Production Plan Sales Order
  2. set up the Fetch From to sales_order.po_no

What is the effect:

  1. new field appears in Production Plan, but it is empty.

Could anyone point me in the right direction?

I’ve read a lot of posts here, and tried different technique but to no avail.
One thing I tried many times is placing the “sales_order.po_no” string into Options tab in the Customization tool.
Also tried changing the type of field from DATA to LINK. Effect is the same.

Thanks a lot for your help.

Ideally, this should work, I tried recreating the same and it worked fine for me. Please do verify that the Customer’s purchase order number is saved in the appropriate field.

ignore inappropriate po attachment file :sweat_smile:

Thank you so much for taking the time to reply! :slight_smile:
Unfortunately I did as you said and it doesn’t work :frowning:

Here is my example Sales Order:

Here is the custom field config:

And here is the result:

BTW - all of my Sales Orders have the field with Customer’s Purchase Order populated. As you can see fields are blank in Production Plan.

Also, we are on latest version 12. Thanks a lot for your input!


Maybe anyone have an idea of what’s wrong with the script?

It seems it is really the same as scripts that work for others.

Thanks a lot.

You can achieve the same from using custom script.

In the following script I am fetching the operation value which is store in my item master and when I am making a bom and selecting a item, operation value is automatically fetched from item master.

frappe.ui.form.on(“BOM Item”, “item_code”, function(frm, cdt, cdn) {
var d = locals[cdt][cdn];
frappe.db.get_value(“Item”, {“name”: d.item_code}, “operation”, function(value) {
d.operation = value.operation;

I will try that and let you know. Many thanks @Ranbir

1 Like