How to hide child doc fields?

Please try this.

frappe.ui.form.on("Finished Goods Process Child", "finish_goods_process_child_add", function(frm) {
     if ('grid' in cur_frm.fields_dict.finish_goods_process_child) {
         var grid =  cur_frm.fields_dict.finish_goods_process_child.grid;         
         var interval = setInterval(function () {
             if ('cur_grid' in grid.frm) {
                 if(cur_frm.doc.typ != "Carton"){


It works!
Thank you very much Mr Mainul :slight_smile:

Is this code supposed to be cahnged/written in a file on the server or put as a custom script? (sorry for the noob question, I’m still learning).

Yes, you need write this code in “doctype_file.js” on DocType Directory.

1 Like

Thank you!

@Aourongajab_Abir @sorin.negulescu

You can use eval:parent.carton_type==="Carton" in “Depends On” property of child fields “carton_no”.



Thank you :slight_smile:

can i hide a specific item?

What is your usecase @Denmark_Del_Puso? Pls explain further.


dear i am using this code to hide rate field depending on update stock but when i write this code in depend on field it completely disappear the rate field in the form but in list view it works fine.

Please help me on this and can anyone let me know to to write same code depending on item code

Hi @mainul
For every row of child table, Is it possible to hide/show a custom field when Item Code uom(Must be Whole Number) is selected.

can you give an Example?

Suppose to be, I have 2-items x and y. For item-x the uom(Must be Whole Number) is checked, so we should show custom_field in child table. For item-y the uom(Must be Whole Number) is unchecked, so we should hide custom_field in child table.

In custom field depend on just use check_fieldname.
if you must be whole number field in Item Doctype, Then fetch this field in child table.

The check_fieldname present in UOM Doc.
please can you provide any sample code?

fetch is numeric from UOM

Hide and show Numeric value field

Thanks @mainul
But everytime manually i have to select that check box(Is Numeric).
Scenario like:
If you check Purchase Receipt Item/any child doc, Item wil have default uom(eg:-Nos).
Supose, By default the check_fieldname(Must be Whole Number ) of UOM(Nos) is selected. In this case automatically custom_field should appear otherwise should not appear.
Please check the attached screen shots.

check fetch from.
if doesn’t work.
set on event on item select.

fetch from is : uom.must_be_whole_number in Purchase Receipt Item doc. Right?