-
I created a Custom Print Format for a Custom Doctype in a custom app.
-
I created a server script in apps/my_app/my_app/my_server_script.py with a funcion my_function(docname) which returns a list of dictionaries
-
I added in hooks.py of my_app:
jinja = {
"methods": "my_app.my_server_script"
}
Any help is greatly appreciated
ERPNext: v14.35.0 (version-14)
Frappe Framework: v14.45.0 (version-14)
Frappe HR: v14.10.1 (version-14)
1 Like
You need to specify the path upto the method name. Jinja hooks can only map to functions within a file and not a file as a whole.
Thanks for your answer, but even after the correction and a bench restart, it is still undefined…
NCP
4
Check it out if you haven’t seen it.
1 Like
Hi @NCP.
I read it very carefully but the method is still undefined.
In optica/jinja/methods.py
def group_lenses_by_opcion(lens_data):
pass
In optica/hooks.py
jinja = {
"methods": [
"optica.jinja.methods"
]
}
In Custom Print Format:
<div>{{ group_lenses_by_opcion(doc.lentes_recomendados) }}</div>
1 Like
The Documentation on Hooks reads:
If the path is a module path, all the methods in that module will be added.
So the error shouldn’t be in that direction…
1 Like
Can someone verify my configuration? I would like not to spend days searching for a wrong comma
Thanks