I wanted to email my POS receipt, but when I tried it returned an error
The error stack trace is
### App Versions
{
"erpnext": "14.36.0",
"expense_request": "0.0.1",
"frappe": "14.46.0"
}
### Route
point-of-sale
### Traceback
Traceback (most recent call last):
File "apps/frappe/frappe/app.py", line 94, 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 47, in handle
data = execute_cmd(cmd)
File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File "apps/frappe/frappe/__init__.py", line 1622, in call
return fn(*args, **newargs)
File "apps/frappe/frappe/core/doctype/communication/email.py", line 78, in make
return _make(
File "apps/frappe/frappe/core/doctype/communication/email.py", line 172, in _make
comm.send_email(
File "apps/frappe/frappe/core/doctype/communication/mixins.py", line 305, in send_email
if input_dict := self.sendmail_input_dict(
File "apps/frappe/frappe/core/doctype/communication/mixins.py", line 284, in sendmail_input_dict
"content": self.get_content(print_format=print_format),
File "apps/frappe/frappe/core/doctype/communication/mixins.py", line 142, in get_content
return self.content + self.get_attach_link(print_format)
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
### Request Data
{
"type": "POST",
"args": {
"recipients": "roderick.lim31@gmail.com",
"subject": "POS Invoice: BTD230905-00038",
"doctype": "POS Invoice",
"name": "BTD230905-00038",
"send_email": 1,
"print_format": "POS INV - BV",
"sender_full_name": "Bossvape Master",
"_lang": "en"
},
"headers": {},
"error_handlers": {},
"url": "/api/method/frappe.core.doctype.communication.email.make"
}
### Response Data
{
"exception": "TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'"
}
I’m using a custom print format as well with the Jinjja Print Format Type
<!DOCTYPE html>
<head>
<style>
.print-format table, .print-format tr,
.print-format td, .print-format div, .print-format p {
line-height: 100%;
vertical-align: middle;
font-size:10px;
letter-spacing: 1px;
}
@media screen {
.print-format {
width: 2.17in;
padding: 0.05in;
}
}
.print-format table {
margin:0;
}
.print-format td {
padding: 8px !important;
}
.print-format tr, .print-format td {
height:5px;
line-height: 8px;
padding: 0s
}
.table>tbody>tr>td {
height:8px;
line-height: 8px;
}
@page {
margin:6px;
}
h2 {
font-weight: bold;
}
h4 {
font-weight: bold;
font-size: 12px;
}
td {
border-style: dashed top;
}
</style>
</head>
<body>
<table class="table table-condensed text-center">
<tr>
<td style="border: 0">
<img src="/files/logo-08.png" style="" width="100"><br>
<h4>Bossvape Tanjung Duren</h4><br>
<p>Jl. Tanjung Duren Raya No. 353A, Jakarta Barat</p><br>
<h4>{{ doc.name }} </h4>
</td>
</tr>
</table>
<table class="table table-condensed">
<tr>
<td style="border-bottom: 1px solid #d1d8dd">
<p>{{ _("Pelanggan") }} : {{ frappe.get_fullname(doc.customer_name) }}</p><br>
<p>{{ _("Transaksi") }} : {{ doc.get_formatted("posting_date") }}, {{ doc.get_formatted("posting_time") }}</p><br>
<p>{{ _("Karyawan") }} : {{ frappe.get_fullname(doc.sales_partner) }}</p><br>
</td>
</tr>
</table>
<table class="table table-condensed">
<tbody>
{%- for item in doc.items -%}
<tr>
<td style="border: 0; width:100%">
<p style="font-weight:bold;">{{ item.item_name }}<p>
</td>
</tr>
<tr>
<td style="width: 50%;border: 0; letter-spacing:0px;" class="text-left">
{{ item.qty | round | int }} {{ item.uom }} X {{ item.get_formatted("rate", doc) }}
</td>
<td style="width: 50%;border: 0; letter-spacing:0px;" class="text-right">
{{ item.get_formatted("amount", doc) }}
</td>
</tr>
{%- endfor -%}
</tbody>
</table>
<table class="table table-condensed">
<tr>
<td style="width: 60%" class="text-right">
{{ _("Total Barang") }} :
</td>
<td style="width: 40%" class="text-right">
{{ doc.total_qty }}
</td>
</tr>
<tr>
<td style="width: 40%" class="text-right">
{{ _("Subtotal") }} :
</td>
<td style="width: 60%" class="text-right">
{{ doc.get_formatted("total") }}
</td>
</tr>
</table>
<table class="table table-condensed">
<tr>
<td class="text-right">
<h4>
{{ _("Total") }}: {{ doc.get_formatted("grand_total") }}
</h4>
</td>
</tr>
</table>
<table class="table table-condensed">
{%- for row in doc.payments -%}
{%- if row.amount -%}
<tr>
<td class="text-right" style="width: 50%;">
{{ row.mode_of_payment }} :
</td>
<td class="text-right" style="width: 50%;">
{{ row.get_formatted("amount", doc) }}
</td>
</tr>
{%- endif -%}
{%- endfor -%}
</table>
{%- if doc.discount_amount -%}
<table class="table table-condensed">
<tr>
<td class="text-right" style="width: 55%;">
{{ _("Diskon Transaksi") }} :
</td>
<td class="text-right" style="width: 45%;">
{{ doc.get_formatted("discount_amount") }}
</td>
</tr>
</table>
{%- endif -%}
<table class="table table-condensed text-center">
<tr>
<td>
<p class="text-center">{{ _("Salam Khilaf, Salam Bossvape") }}</p>
</td>
</tr>
</table>
<table class="table table-condensed text-center">
<tr>
<td>
<p class="text-left">{{ _("Whatsapp : 081928888388") }}</p><br>
<p class="text-left">{{ _("Instagram : bossvap.tanjungduren") }}</p>
</td>
</tr>
</table>
</body>
</html>