feat: hook for print format template loader (#25037)
* feat: hook for print format template loader currently logic for how print format template should be loaded is hardcoded added hook to allow for custom logic to be implemented by other apps. if hook returns falsy value, then default logic will be used. * chore: use Walrus Operator and handle Empty Hooks
This commit is contained in:
parent
501297b71c
commit
ce2d91c751
1 changed files with 7 additions and 1 deletions
|
|
@ -162,7 +162,13 @@ def get_rendered_template(
|
|||
def get_template_from_string():
|
||||
return jenv.from_string(get_print_format(doc.doctype, print_format))
|
||||
|
||||
if print_format.custom_format:
|
||||
template = None
|
||||
if hook_func := frappe.get_hooks("get_print_format_template"):
|
||||
template = frappe.get_attr(hook_func[-1])(jenv=jenv, print_format=print_format)
|
||||
|
||||
if template:
|
||||
pass
|
||||
elif print_format.custom_format:
|
||||
template = get_template_from_string()
|
||||
|
||||
elif print_format.format_data:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue