Try ERPNext Buy Support Partners Foundation

"Depends On" in a new field

Dear all,

I’m not sure what changed, but some times ago I created a lots of new fields in the item form.
All these fields had condition on the “Depends On” part… like
eval:doc.item_group==“Fertiliser”
or
eval:doc.item_group==“Fungicide”||eval:doc.item_group==“Insecticide”

Now I noticed that these fields (which I only wanted to show for these specific item_group are being displayed regardless of the item_group.

I did change the item_group tree a while back where I have put all these item_group under a new parent.

Any advice on how to repair that?

Thanks in advance,

François

I don’t think it is related to the changes in item group tree.

I can check an error in your example code: eval:doc.item_group=="Fungicide"||eval:doc.item_group=="Insecticide"

This should be like below:

eval:((doc.item_group=="Fungicide") || (doc.item_group=="Insecticide"))
3 Likes

Thanks Nabin.
Are you sure, because I got this from:

Any way I’ve tried your solution as well, It seems like both options works.
Now, what is weird is that first it didn’t change anything, then 10 minutes laters, all the changes took effect.

How can that be? Is this a cache issue (I’m on Chrome)? Or something to do with the server that render the page (I’m on frappecloud)?

The code is same as rmehta suggested, just enclosed them inside bracket.

I have tested the same in my local system and it works.

How can we show a field depending on whether the parent field has a value. To be specific, value of more than 0, then the child table should become visible…?

Thank you.

eval:doc.field_name != null

Figured it while ago, thanks anyways :slight_smile: