'NoneType' object has no attribute 'fieldtype' Attribute error

file:///home/zero/Pictures/Screenshots/Screenshot%20from%202022-07-10%2022-12-08.png

App Versions

{
	"erpnext": "14.0.0-dev",
	"frappe": "14.0.0-dev",
	"startup_app": "0.0.1"
}

Route

print/Print Format/Web form print

Trackeback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 68, 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 1574, 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 1087, in get_formatted
    df.fieldtype == "Currency"
AttributeError: 'NoneType' object has no attribute 'fieldtype'

Request Data

{
	"type": "POST",
	"args": {
		"doc": "{\"name\":\"POS Invoice\",\"owner\":\"Administrator\",\"creation\":\"2011-12-21 11:08:55\",\"modified\":\"2021-04-15 15:23:28.867135\",\"modified_by\":\"Administrator\",\"docstatus\":0,\"idx\":1,\"doc_type\":\"POS Invoice\",\"module\":\"Selling\",\"standard\":\"Yes\",\"custom_format\":1,\"disabled\":0,\"print_format_type\":\"Jinja\",\"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\\tline-height: 150%;\\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{% if letter_head %}\\n    {{ letter_head }}\\n{% endif %}\\n\\n<p class=\\\"text-center\\\" style=\\\"margin-bottom: 1rem\\\">\\n\\t{{ doc.company }}<br>\\n\\t<b>{{ doc.select_print_heading or _(\\\"Invoice\\\") }}</b><br>\\n</p>\\n<p>\\n\\t<b>{{ _(\\\"Receipt No\\\") }}:</b> {{ doc.name }}<br>\\n\\t<b>{{ _(\\\"Cashier\\\") }}:</b> {{ doc.owner }}<br>\\n\\t<b>{{ _(\\\"Customer\\\") }}:</b> {{ doc.customer_name }}<br>\\n\\t<b>{{ _(\\\"Date\\\") }}:</b> {{ doc.get_formatted(\\\"posting_date\\\") }}<br>\\n\\t<b>{{ _(\\\"Time\\\") }}:</b> {{  doc.get_formatted(\\\"posting_time\\\") }}<br>\\n</p>\\n\\n<hr>\\n<table class=\\\"table table-condensed\\\">\\n\\t<thead>\\n\\t\\t<tr>\\n\\t\\t\\t<th width=\\\"50%\\\">{{ _(\\\"Item\\\") }}</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 doc.items -%}\\n\\t\\t<tr>\\n\\t\\t\\t<td>\\n\\t\\t\\t\\t{{ item.item_code }}\\n\\t\\t\\t\\t{%- if item.item_name != item.item_code -%}\\n\\t\\t\\t\\t\\t<br>{{ item.item_name }}\\n\\t\\t\\t\\t{%- endif -%}\\n\\t\\t\\t\\t{%- if item.serial_no -%}\\n\\t\\t\\t\\t\\t<br><b>{{ _(\\\"SR.No\\\") }}:</b><br>\\n\\t\\t\\t\\t\\t{{ item.serial_no | replace(\\\"\\\\n\\\", \\\", \\\") }}\\n\\t\\t\\t\\t{%- endif -%}\\n\\t\\t\\t</td>\\n\\t\\t\\t<td class=\\\"text-right\\\">{{ item.qty }}<br>@ {{ item.get_formatted(\\\"rate\\\") }}</td>\\n\\t\\t\\t<td class=\\\"text-right\\\">{{ item.get_formatted(\\\"amount\\\") }}</td>\\n\\t\\t</tr>\\n\\t\\t{%- endfor -%}\\n\\t</tbody>\\n</table>\\n<table class=\\\"table table-condensed no-border\\\">\\n\\t<tbody>\\n\\t\\t<tr>\\n\\t\\t\\t{% if doc.flags.show_inclusive_tax_in_print %}\\n\\t\\t\\t\\t<td class=\\\"text-right\\\" style=\\\"width: 70%\\\">\\n\\t\\t\\t\\t\\t{{ _(\\\"Total Excl. Tax\\\") }}\\n\\t\\t\\t\\t</td>\\n\\t\\t\\t\\t<td class=\\\"text-right\\\">\\n\\t\\t\\t\\t\\t{{ doc.get_formatted(\\\"net_total\\\", doc) }}\\n\\t\\t\\t\\t</td>\\n\\t\\t\\t{% else %}\\n\\t\\t\\t\\t<td class=\\\"text-right\\\" style=\\\"width: 70%\\\">\\n\\t\\t\\t\\t\\t{{ _(\\\"Total\\\") }}\\n\\t\\t\\t\\t</td>\\n\\t\\t\\t\\t<td class=\\\"text-right\\\">\\n\\t\\t\\t\\t\\t{{ doc.get_formatted(\\\"total\\\", doc) }}\\n\\t\\t\\t\\t</td>\\n\\t\\t\\t{% endif %}\\n\\t\\t</tr>\\n\\t\\t{%- for row in doc.taxes -%}\\n\\t\\t  {%- if not row.included_in_print_rate or doc.flags.show_inclusive_tax_in_print -%}\\n\\t\\t\\t<tr>\\n\\t\\t\\t\\t<td class=\\\"text-right\\\" style=\\\"width: 70%\\\">\\n\\t\\t\\t\\t    {% if '%' in row.description %}\\n\\t\\t\\t\\t\\t    {{ row.description }}\\n\\t\\t\\t\\t\\t{% else %}\\n\\t\\t\\t\\t\\t    {{ row.description }}@{{ row.rate }}%\\n\\t\\t\\t\\t\\t{% endif %}\\n\\t\\t\\t\\t</td>\\n\\t\\t\\t\\t<td class=\\\"text-right\\\">\\n\\t\\t\\t\\t\\t{{ row.get_formatted(\\\"tax_amount\\\", doc) }}\\n\\t\\t\\t\\t</td>\\n\\t\\t\\t<tr>\\n\\t\\t  {%- endif -%}\\n\\t\\t{%- endfor -%}\\n\\n\\t\\t{%- if doc.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{{ doc.get_formatted(\\\"discount_amount\\\") }}\\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{{ doc.get_formatted(\\\"grand_total\\\") }}\\n\\t\\t\\t</td>\\n\\t\\t</tr>\\n\\t\\t{%- if doc.rounded_total -%}\\n\\t\\t<tr>\\n\\t\\t\\t<td class=\\\"text-right\\\" style=\\\"width: 75%\\\">\\n\\t\\t\\t\\t<b>{{ _(\\\"Rounded Total\\\") }}</b>\\n\\t\\t\\t</td>\\n\\t\\t\\t<td class=\\\"text-right\\\">\\n\\t\\t\\t\\t{{ doc.get_formatted(\\\"rounded_total\\\") }}\\n\\t\\t\\t</td>\\n\\t\\t</tr>\\n\\t\\t{%- endif -%}\\n\\t\\t{%- for row in doc.payments -%}\\n\\t\\t\\t<tr>\\n\\t\\t\\t\\t<td class=\\\"text-right\\\" style=\\\"width: 70%\\\">\\n\\t\\t\\t\\t    {{ row.mode_of_payment }}\\n\\t\\t\\t\\t</td>\\n\\t\\t\\t\\t<td class=\\\"text-right\\\">\\n\\t\\t\\t\\t\\t{{ row.get_formatted(\\\"amount\\\", doc) }}\\n\\t\\t\\t\\t</td>\\n\\t\\t\\t<tr>\\n\\t\\t{%- endfor -%}\\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{{ doc.get_formatted(\\\"paid_amount\\\") }}\\n\\t\\t\\t</td>\\n\\t\\t</tr>\\n\\t\\t{%- if doc.change_amount -%}\\n\\t\\t\\t<tr>\\n\\t\\t\\t\\t<td class=\\\"text-right\\\" style=\\\"width: 75%\\\">\\n\\t\\t\\t\\t\\t<b>{{ _(\\\"Change Amount\\\") }}</b>\\n\\t\\t\\t\\t</td>\\n\\t\\t\\t\\t<td class=\\\"text-right\\\">\\n\\t\\t\\t\\t\\t{{ doc.get_formatted(\\\"change_amount\\\") }}\\n\\t\\t\\t\\t</td>\\n\\t\\t\\t</tr>\\n\\t\\t{%- endif -%}\\n\\t</tbody>\\n</table>\\n<hr>\\n<p>{{ doc.terms or \\\"\\\" }}</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,\"print_format_builder\":0,\"print_format_builder_beta\":0,\"doctype\":\"Print Format\",\"__onload\":{\"print_templates\":[]},\"__last_sync_on\":\"2022-07-10T16:34:02.732Z\"}",
		"print_format": "Standard",
		"no_letterhead": 1,
		"letterhead": "No Letterhead",
		"settings": "{}",
		"_lang": "en"
	},
	"headers": {},
	"error_handlers": {},
	"url": "/api/method/frappe.www.printview.get_html_and_style"
}

Response Data

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