Depend_on field of link field

Hello,
I’m trying to create a new Doctype TaxSheet.
TaxSheet has a required Link field to the Customer Doctype named customer.
Now, I would like to add a field to TaxSheet, that only appears when a certain field of the linked Customer has a certain value.

For instance, I tried to add a Checkbox field, that only appears if customer.tax_id == 17. For that I set the value of “visibility depends_on” to eval: doc.customer && doc.customer.tax_id==13. However, the field never appears, no matter what value I set in the customer…

How can I fix this? Thank you

Hello @timo,

First added an one filed like tax_id after that fetch value form customer.
When you select customer then tax_id fetch and set “visibility depends_on” to eval: doc.customer && doc.tax_id==13

Thanks!

Hi @NCP,
Thanks for your response.
While this works, I think it’s not really an efficient way. We have dozens of custom fields on the Customer DocType and having to create a copy for each one in TaxSheet is cumbersome and error-prone.

Is there any other solution?
Thanls!

Did you figure out how to do this? I am working on a custom field, that depends on the sub field of account_head selected. And I cant figure out how to achieve this!