Custom Functions in Print Format v14

I used to use custom functions in jinja print format using the following structure in Frappe version 13:

  1. Defining the function and adding the @frappe.whiteliat() decorator to it.
  2. Defining it for jinja environment in as follows:
    jenv = {
    “methods”: [
  3. Calling it in my custom print format as: {{ print_discount(…)}}

    Now that I upgraded the system to version 14.
    It gives me “print_discount” is not defined"!

Any help on that would be appreciated.

Default format in in v14

# Jinja

# ----------

# add methods and filters to jinja environment
 jinja = {

"methods": "app.utils.jinja_methods",

"filters": "app.utils.jinja_filters"

# }

use “jinja” instead of “jenv”

1 Like