fix: use startsWith('Sales') for party labels in print templates

Templates hard-coded `doc.entryType === 'SalesInvoice'` to determine
party labels (Customer/Supplier, To/From) and the document heading
(Invoice/Bill). This caused SalesQuote, PurchaseOrder, and other
entry types to fall through to the wrong label.

- Business template: use `doc.entryLabel` for the heading instead of
  hard-coded 'Invoice'/'Bill', and `startsWith('Sales')` for the
  Customer/Supplier label
- Minimal template: use `startsWith('Sales')` for the To/From labels

Fixes frappe/books#1399
This commit is contained in:
Will Neill
2026-02-16 14:02:30 +01:00
parent c7b8a5a315
commit ddb67701bd
2 changed files with 4 additions and 6 deletions
+2 -4
View File
@@ -26,9 +26,7 @@
<div class="mt-8 text-lg">
<!-- Doc Details -->
<section class="flex">
<h3 class="w-1/3 font-semibold">
{{ doc.entryType === 'SalesInvoice' ? 'Invoice' : 'Bill' }}
</h3>
<h3 class="w-1/3 font-semibold">{{ doc.entryLabel }}</h3>
<div class="w-2/3 text-gray-800">
<p class="font-semibold">{{ doc.name }}</p>
@@ -42,7 +40,7 @@
<!-- Party Details -->
<section class="mt-4 flex">
<h3 class="w-1/3 font-semibold">
{{ doc.entryType === 'SalesInvoice' ? 'Customer' : 'Supplier' }}
{{ doc.entryType.startsWith('Sales') ? 'Customer' : 'Supplier' }}
</h3>
<div class="w-2/3 text-gray-800" v-if="doc.party">
+2 -2
View File
@@ -35,7 +35,7 @@
<!-- Party Details -->
<section class="w-1/2">
<h3 class="uppercase text-sm font-semibold tracking-widest text-gray-800">
{{ doc.entryType === 'SalesInvoice' ? 'To' : 'From' }}
{{ doc.entryType.startsWith('Sales') ? 'To' : 'From' }}
</h3>
<p class="mt-4 text-black leading-relaxed text-lg">{{ doc.party }}</p>
<p
@@ -64,7 +64,7 @@
ml-8
"
>
{{ doc.entryType === 'SalesInvoice' ? 'From' : 'To' }}
{{ doc.entryType.startsWith('Sales') ? 'From' : 'To' }}
</h3>
<p class="mt-4 ml-8 text-black leading-relaxed text-lg">
{{ print.companyName }}