Try ERPNext Buy Support Partners Foundation

V13 "Mandatory Depends On" documentation/guide wanted

Hello Community. Currently testing out the v13 and loving it! Awesome work, again!

However, I could make use if the “Mandatory Depends On” feature on certain fields. For example, I could make a “item part number” field become mandatory when “item has a part number” is checked or something. I’ve tried few methods, but couldn’t get it to work.

I’ve seen the Documentation PR, but it had no explanation.

Any help is appreciated :smiley:

Hi @iMoshi,

Mandatory Depends On works just like the Depends On property. Just setting
"mandatory_depends_on": "eval:doc.item_has_part_number"
for the “item part number” field should work!

1 Like

per my experience and checking the code, the mandatory depends_on only works on regular doctype not the child doctype.

created a new issue with attached code change, hopefully someone from the core team can help to make a PR accordingly.

1 Like

Oh wow, thank you so much!

I’ve got your code in my Frappe, and the “Mandatory Depends On” now works in child DocTypes, but now I’m unable to Save the doc just so you know. Could be me though :stuck_out_tongue_winking_eye:

so what is the console error?

Hello there. It’s been a while and I forgot to reply to the thread.

I’m successfully using your code, and it’s working beautifully. Although, I figured you forgot to declare the reqd in the script, that’s all :slight_smile:

Thank you so much (so late), and stay safe!