Try ERPNext Buy Support Partners Foundation Foundation Members

How to get HSN Code in Purchase Order with Item Inserted

While Creating the purchase Order how get HSN Code along with Items?

Create hsn as a new field in the P.O doc and in the fetch write this item_code.hsn then check that box fetch n unchech print hide n it should work

Do look for other answers …i am also new to erpnext but i was facing similar situation

1 Like

@Sunilshirsat @Essential_Queries

frappe.call({
            method: "frappe.client.get_value",
            args: {
                "doctype": "Item",
                "filters": {
                    'name': item_name, 
                },
                "fieldname": ['gst_hsn_code']
            },
            callback: function (r) {
                if(r.message != undefined) {
                      console.log(r.message.gst_hsn_code)
                }
            }
        });  

I hope this Custom Script Solves your problem. :slight_smile:

3 Likes

Hi Rohan
I am just curious why this script which you have given.Why not simpler one “A.B”
where A is the item code and B would be the field in which you have to fetch the value and If you see for HSN/SAC erp guys have used the simpler code…Please guide me. It would be great if I am able to see the answer to question from your point of view .
Willing to learn
Thanks
EQ

1 Like