How to show/hide fields in journal entry based on accounts that has been selected?

Hi

I have added several custom fields to journal entry page, i want to show/hide them based on chosen accounts.

for example if they chose account number 11001 some extra fields would be available to fill.

Thanks in advance

@alireza_mar2008 check this Show or hide column base on condition

Thank you @Jeel, Even though I didn’t want to remove the columns but the sample codes gave me several ideas and helped me. I have added a hidden select control under “journal entry account” which is the model behind every row of below table.

I have already found the account event and set_account_details which is called after selecting the account. my current issue is to find the hidden control that is created and change it’s hidden attribute in below page.

I have already tried frm.fields_dict.accounts.grid.fields_map.sanama_type.hidden = 0 and locals[dt][dn].sanama_type.hidden = 0 which didn’t work.

Thanks

Hi @alireza_mar2008:

Try

frm.fields_dict.accounts.grid.toggle_display("sanama_type", true) or frm.fields_dict.accounts.grid.toggle_display("sanama_type", false)

Hope this helps.

Hi @avc

Thanks a lot, It worked!!

Hi @alireza_mar2008:

Glad to be helpful. Anyway, many times this kind of show/hide behavior could be managed from Customize Form (here child table form), using depends_on property. Check this sample …