Generic function for multiple hooks for permission_query_condition

I have custom hooks for my app

permission_query_conditions = {
“Sales Invoice”: “foundryapp.sample.get_invoice_based_permission_date”,
“Payment Entry”: “foundryapp.sample.get_payment_based_permission_date”,
“Purchase Invoice”: “foundryapp.sample.get_purchaseinv_based_permission_date”
}

all three does the same thing. So instead of writing three functions i want a generic function where i can write the logic based on doctype name.
Is there a way to achieve this

any pointers, help, support is appreciated

Thank You.

Hi @Yashwanth,
I think you can do it like this
image
Give it a try, and let me know the result :smiley:

@antzforwork Thank you, for your suggestion. I definitely will try this and let you know.

@antzforwork I tried this but this would work for all Doctypes , I wanted for only few doctypes so had to write overloaded function but the permission query remained same.