Why added server script will not reflected in module code?


I added server script with type of permission query. It’s working. But, why added server script will not reflected in module code?

You can also export server script using fixtures
this may help for you

Hi @abrarpv97 ,

Thank you for your reply. I tried in hooks.py
fixtures = [“Server Script”] only. Its added to code after bench export-fixtures.
But you gave doctype with filter in fixtures. What will happen if we use filter in fixture? and can we use doctype Users, User Permission in fixtures? I tried but it shows some error.

It’s a bit unusual to export server scripts as fixtures. More typically, you’d just write the permission query to your app’s hooks directly.


Hi @peterg,

I tried permission query in my app as you said. Its working. Thank you.
I have an another doubt. I return permission query condition like this

return “(tabMaterial Request.owner = {user} and tabMaterial Request.purpose = {purpose})”.format(user=frappe.db.escape(user), purpose=“Material Transfer”)

but its shows error.

pymysql.err.ProgrammingError: (1064, “You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ‘Transfer))\n\t\t\t group by tabMaterial Request.name\n\t\t\t order by `tabMateria…’ at line 3”)