Help needed on Read Only Depends On

Hello community, having a small problem where my field’s ability to be Read Only depending on another field is not working.

So, there’s “Status” field with multiple options, and one of the is “Closed”. I want my fields to be “Read Only” after the status is changed to Closed. I have inserted the following to my field’s “read only depends on” but it’s just not working:

eval:doc.status = ‘Closed’

I’m on v13 of both Frappe and ERPNext. The problem I’m having is no matter what the status is, the field became read only always.

Thanks guys!

Hi @iMoshi,

Which Doctype?

Thanks.

Well, any doctype. This case, Issue doctype :slight_smile:

Hi @iMoshi,

Please check it.
It’s working from my side.

eval:doc.status=='Closed'

I try for description.

It’s writeable

It’s Read Only.

Again check, reload and try it.

Thank You!

2 Likes

Thank you! This fixes it :sweat_smile:

So, the spaces were messing things up? Got it now.

Hi, what will be code if i want a particular select field to appear on a “OR” condition like

eval:doc.status==‘Closed’ OR eval:doc.status==“Hold”

what will be proper way to address “OR” if a particular select field needs to be appear on 2 depend on conditions ?

Ok i figured it out…

it is eval:((doc.gate==“1”) || (doc.globe==“1”)) and so on howmany items i need… !!

Thanks to me :smiley:

2 Likes

how to mention a depend on a checkbox in a different section break ?

noorain

but for me it did not worked

i have table inside a doctype table means it will be a child table like which have product name , sub product name price status (Pending by default, Approved and Expired)
i want when the sttaus is Approved and Expired make the field read only not the when status is pending

how to hanlde this i have tried
eval:((doc.status==“Approved”) || (doc.status==“Expired”))
eval:(doc.status == “Approved”) || (doc.status == “Expired”)

if possible can u please help me with this

can you post a picture of your fieldnames and where you put this code ?

THIS is child table
where i need to give read only


this si all the filed of child table

so it seems , you are putting the eval in doctype whereas you want this to run for child table ? right >?

right i need eval for child table field not the main doctype where this child table was used

You must use a client script for this; better. because i beleive the depends on condition eval mostly does work on the doctype field states and not child tables states.

I am not a software engineer, but has some experience in customisation of erpnext for my own company. May, in the loop we have @NCP can give a better suggestion.

I dont want to do js i have already build read only by doing code in js but my manager want to handle without js code

i am building custom app using the frappe framework python and js

thank u for your reply