Print Formats Error while priting - Server Error AttributeError: 'NoneType' object has no attribute

App Versions

{
	"erpnext": "14.15.1",
	"frappe": "14.25.1",
	"hrms": "14.0.0",
	"payments": "0.0.1"
}

Route

print/Print Format/Point of Sale

Trackeback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 69, in application
    response = frappe.api.handle()
  File "apps/frappe/frappe/api.py", line 54, in handle
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 45, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 83, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1607, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/www/printview.py", line 294, in get_html_and_style
    html = get_rendered_template(
  File "apps/frappe/frappe/www/printview.py", line 207, in get_rendered_template
    html = template.render(args, filters={"len": len})
  File "env/lib/python3.10/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "env/lib/python3.10/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "apps/frappe/frappe/templates/print_formats/standard.html", line 32, in top-level template code
    {{ render_field(df, doc, no_of_cols) }}
  File "env/lib/python3.10/site-packages/jinja2/sandbox.py", line 393, in call
    return __context.call(__obj, *args, **kwargs)
  File "env/lib/python3.10/site-packages/jinja2/runtime.py", line 777, in _invoke
    rv = self._func(*arguments)
  File "apps/frappe/frappe/templates/print_formats/standard_macros.html", line 5, in template
    <div>{{ frappe.render_template(df.options, {"doc": doc}) or "" }}</div>
  File "env/lib/python3.10/site-packages/jinja2/sandbox.py", line 393, in call
    return __context.call(__obj, *args, **kwargs)
  File "apps/frappe/frappe/utils/jinja.py", line 85, in render_template
    return get_jenv().from_string(template).render(context)
  File "env/lib/python3.10/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "env/lib/python3.10/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 21, in top-level template code
  File "env/lib/python3.10/site-packages/jinja2/sandbox.py", line 393, in call
    return __context.call(__obj, *args, **kwargs)
  File "apps/frappe/frappe/model/base_document.py", line 1106, in get_formatted
    df.fieldtype == "Currency"
AttributeError: 'NoneType' object has no attribute 'fieldtype'

Request Data

{
	"type": "POST",
	"args": {
		"doc": "{\"name\":\"Point of Sale\",\"owner\":\"Administrator\",\"creation\":\"2016-05-05 17:16:18.564460\",\"modified\":\"2019-09-05 17:20:30.726659\",\"modified_by\":\"Administrator\",\"docstatus\":0,\"idx\":0,\"doc_type\":\"Sales Invoice\",\"module\":\"Accounts\",\"standard\":\"Yes\",\"custom_format\":1,\"disabled\":0,\"print_format_type\":\"JS\",\"raw_printing\":0,\"html\":\"<style>\\n\\t.print-format table, .print-format tr, \\n\\t.print-format td, .print-format div, .print-format p {\\n\\t\\tfont-family: Monospace;\\n\\t\\tline-height: 200%;\\n\\t\\tvertical-align: middle;\\n\\t}\\n\\t@media screen {\\n\\t\\t.print-format {\\n\\t\\t\\twidth: 4in;\\n\\t\\t\\tpadding: 0.25in;\\n\\t\\t\\tmin-height: 8in;\\n\\t\\t}\\n\\t}\\n</style>\\n\\n<p class=\\\"text-center\\\">\\n\\t{{ company }}<br>\\n\\t{{  __(\\\"POS No : \\\") }} {{ offline_pos_name }}<br>\\n</p>\\n<p>\\n\\t<b>{{ __(\\\"Customer\\\") }}:</b> {{ customer }}<br>\\n</p>\\n\\n<p>\\n\\t<b>{{ __(\\\"Date\\\") }}:</b> {{ dateutil.global_date_format(posting_date) }}<br>\\n</p>\\n\\n<hr>\\n<table class=\\\"table table-condensed cart no-border\\\">\\n\\t<thead>\\n\\t\\t<tr>\\n\\t\\t\\t<th width=\\\"50%\\\">{{ __(\\\"Item\\\") }}</b></th>\\n\\t\\t\\t<th width=\\\"25%\\\" class=\\\"text-right\\\">{{ __(\\\"Qty\\\") }}</th>\\n\\t\\t\\t<th width=\\\"25%\\\" class=\\\"text-right\\\">{{ __(\\\"Amount\\\") }}</th>\\n\\t\\t</tr>\\n\\t</thead>\\n\\t<tbody>\\n\\t\\t{% for item in items %}\\n\\t\\t<tr>\\n\\t\\t\\t<td>\\n\\t\\t\\t\\t{{ item.item_name }}\\n\\t\\t\\t</td>\\n\\t\\t\\t<td class=\\\"text-right\\\">{{ format_number(item.qty, null,precision(\\\"difference\\\")) }}<br>@ {{ format_currency(item.rate, currency) }}</td>\\n\\t\\t\\t<td class=\\\"text-right\\\">{{ format_currency(item.amount, currency) }}</td>\\n\\t\\t</tr>\\n\\t\\t{% endfor %}\\n\\t</tbody>\\n</table>\\n\\n<table class=\\\"table table-condensed no-border\\\">\\n\\t<tbody>\\n\\t\\t<tr>\\n\\t\\t\\t<td class=\\\"text-right\\\" style=\\\"width: 70%\\\">\\n\\t\\t\\t\\t{{ __(\\\"Net Total\\\") }}\\n\\t\\t\\t</td>\\n\\t\\t\\t<td class=\\\"text-right\\\">\\n\\t\\t\\t\\t{{ format_currency(total, currency) }}\\n\\t\\t\\t</td>\\n\\t\\t</tr>\\n\\t\\t{% for row in taxes %}\\n\\t\\t{% if not row.included_in_print_rate %}\\n\\t\\t<tr>\\n\\t\\t\\t<td class=\\\"text-right\\\" style=\\\"width: 70%\\\">\\n\\t\\t\\t\\t{{ row.description }}\\n\\t\\t\\t</td>\\n\\t\\t\\t<td class=\\\"text-right\\\">\\n\\t\\t\\t\\t{{ format_currency(row.tax_amount, currency) }}\\n\\t\\t\\t</td>\\n\\t\\t</tr>\\n\\t\\t{% endif %}\\n\\t\\t{% endfor %}\\n\\t\\t{% if discount_amount %}\\n\\t\\t<tr>\\n\\t\\t\\t<td class=\\\"text-right\\\" style=\\\"width: 75%\\\">\\n\\t\\t\\t\\t{{ __(\\\"Discount\\\") }}\\n\\t\\t\\t</td>\\n\\t\\t\\t<td class=\\\"text-right\\\">\\n\\t\\t\\t\\t{{ format_currency(discount_amount, currency) }}\\n\\t\\t\\t</td>\\n\\t\\t</tr>\\n\\t\\t{% endif %}\\n\\t\\t<tr>\\n\\t\\t\\t<td class=\\\"text-right\\\" style=\\\"width: 75%\\\">\\n\\t\\t\\t\\t<b>{{ __(\\\"Grand Total\\\") }}</b>\\n\\t\\t\\t</td>\\n\\t\\t\\t<td class=\\\"text-right\\\">\\n\\t\\t\\t\\t{{ format_currency(grand_total, currency) }}\\n\\t\\t\\t</td>\\n\\t\\t</tr>\\n\\t\\t<tr>\\n\\t\\t\\t<td class=\\\"text-right\\\" style=\\\"width: 75%\\\">\\n\\t\\t\\t\\t<b>{{ __(\\\"Paid Amount\\\") }}</b>\\n\\t\\t\\t</td>\\n\\t\\t\\t<td class=\\\"text-right\\\">\\n\\t\\t\\t\\t{{ format_currency(paid_amount, currency) }}\\n\\t\\t\\t</td>\\n\\t\\t</tr>\\n\\t\\t<tr>\\n\\t\\t\\t<td class=\\\"text-right\\\" style=\\\"width: 75%\\\">\\n\\t\\t\\t\\t<b>{{ __(\\\"Qty Total\\\") }}</b>\\n\\t\\t\\t</td>\\n\\t\\t\\t<td class=\\\"text-right\\\">\\n\\t\\t\\t\\t{{ qty_total }}\\n\\t\\t\\t</td>\\n\\t\\t</tr>\\n\\t</tbody>\\n</table>\\n\\n\\n<hr>\\n<p>{{ terms }}</p>\\n<p class=\\\"text-center\\\">{{ __(\\\"Thank you, please visit again.\\\") }}</p>\",\"margin_top\":0,\"margin_bottom\":0,\"margin_left\":0,\"margin_right\":0,\"align_labels_right\":0,\"show_section_headings\":0,\"line_breaks\":0,\"absolute_value\":0,\"font_size\":0,\"font\":\"Default\",\"print_format_builder\":0,\"print_format_builder_beta\":0,\"doctype\":\"Print Format\",\"__onload\":{\"print_templates\":[]},\"__last_sync_on\":\"2023-02-08T04:21:30.062Z\"}",
		"print_format": "Standard",
		"no_letterhead": 0,
		"letterhead": "QOG - Letter Head (Operations)",
		"settings": "{}",
		"_lang": "en-GB"
	},
	"headers": {},
	"error_handlers": {},
	"url": "/api/method/frappe.www.printview.get_html_and_style"
}

Response Data

{
	"exception": "AttributeError: 'NoneType' object has no attribute 'fieldtype'"
}

The above error while printing any sales invoice and any other print formats.
Tried bench build and migrate. nothing helped
Please help me to get it resolve.

I’m in the same situation.

However the error happens on the POS invoice and some others custom based on that.
My software versions:

ERPNext: v14.15.0
Frappe Framework: v14.25.0
Frappe HR: v1.0.0
Payments: v0.0.1

That Currency on the log does not seem to be used on the offending template.