Item name to be shown along with Item code

Hi All,
Can anyone kindly let me know how Can I have the Item name along with the Item code. This seems to automatically happen when I’m in quotation.

Once once I goto Sales order it doesn’t seem to have that property.

So I had to enable “In list view” for item name and its seems its waste of valuable space. Any idea how to achieve the same as “Quotation”???

I did look up and down in the customization, failed find a specific syntax for it.

BR
Thilina

Refer to this article:
Formatter For Link Fields

Cheers I think this should do,
BTW, can you tell me where to enter this? Is it like a custom script? Or entered at customize form?

You can write this code in two places:

frappe.form.link_formatters['Item'] = function(value, doc) {
    return value;
}
  1. Custom Script (for each DocType you want to change).
  2. Custom JavaScript file on the server (for all DocTypes).

If you can access the server files, I can help you to implement the second approach.

For this 2. Custom JavaScript file on the server (for all DocTypes). where do you add the script is there a specific file?

You could use the following steps:

  • Login to your server via SSH
  • Create a new directory for custom scripts:
mkdir /home/frappe/frappe-bench/apps/erpnext/erpnext/public/js/custom
  • Create a new Js file:
touch /home/frappe/frappe-bench/apps/erpnext/erpnext/public/js/custom/utils.js
  • Add this content to the file and save it:
frappe.form.link_formatters['Item'] = function(value, doc) {
    return value;
}

frappe.form.link_formatters['Employee'] = function(value, doc) {
    return value;
}
  • Edit build.json file:
    /home/frappe/frappe-bench/apps/erpnext/erpnext/public/build.json
  • Append the following item to the array “js/erpnext.min.js”:
"public/js/custom/utils.js"
  • Build assets:
cd /home/frappe/frappe-bench && bench build

Please note that you can choose any name you want for the directory and the file.

3 Likes

this is awesome thanks for the detailed information…

@mibrahim thank you very much for you contribution. I’m on the hosted server so I think SSH is out for, I’ll take the first route.

Thank you for the detailed response.

BR

I’ve created a Pull Request for this problem at: Get text from link formatter in indicator formatter function by SaiFi0102 · Pull Request #6142 · frappe/frappe · GitHub

1 Like

Would you please let me know how to use this in custom script?

Would you please let me know how to use this code in custom script? It would be a great help for me!