Read-only and empty should not hide the field

Currently, read-only fields are hidden if they are empty. I can see why this feature might have seen sensible in the past, but I can’t think of any good reason why this should actually be the case now.

I have just had yet another email from an employee requesting that I make a field visible. That field is already visible, but it is read-only and (in many cases) meaningfully empty. Consequently, it disappears.

I would therefore request that ERPNext stops hiding read-only fields that are hidden.

If I wanted a field hidden, I would have made it hidden.
If I want to make it hidden when it is empty, this would be easy to do with depends_on.
By hiding fields like this you can mess up the layout.

Currently there is no easy way to stop ERPNext hiding the field when it is empty. The only ‘fixes’ are hacks like putting in a default value (but this is a date field, so what is a default value for a date), or making it only read-only client-side with a script, or removing the ‘hidden’ part with a script. This is all unnecessarily complicated and hard to maintain.


I had the same problem, I solved this problem by use custom script to frm.set_value(“name field readonly”, 0)
Hope this can help you.

This would be something to address in frappe not ERPNext.

+1 for this change request. I have some fields that can only be changed via custom dialogs, but I would still like them to be visible when they have no value.

1 Like

For still showing the read-only field when empty, you can set the field to data type and set the read-only parameter inside the field detail popup.

Hi Rahy, are you able to provide more detail on this solution?
I currently have this issue with fields I am setting as read-only … what exactly do you mean by the “field detail popup”?

Thanks, Dan

There are 2 ways to make a field read-only:

  • set the datatype as Read Only;
  • set the field type as anything (e.g. Data) and set the attribute to read-only.

To set the attribute, go to the field detail by clicking the field row. Scroll down until you find the checkboxes with label read-only.

Setting the datatype as Read only, totally hides the field. how should we make field name as visible and read only at the same time?

Use the second way.