From ddb67701bd306c2a61326859dd0fa00cb81baf61 Mon Sep 17 00:00:00 2001 From: Will Neill Date: Mon, 16 Feb 2026 14:02:30 +0100 Subject: [PATCH] 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 --- templates/Business.template.html | 6 ++---- templates/Minimal.template.html | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/templates/Business.template.html b/templates/Business.template.html index 11438d99..9daeee9c 100644 --- a/templates/Business.template.html +++ b/templates/Business.template.html @@ -26,9 +26,7 @@
-

- {{ doc.entryType === 'SalesInvoice' ? 'Invoice' : 'Bill' }} -

+

{{ doc.entryLabel }}

{{ doc.name }}

@@ -42,7 +40,7 @@

- {{ doc.entryType === 'SalesInvoice' ? 'Customer' : 'Supplier' }} + {{ doc.entryType.startsWith('Sales') ? 'Customer' : 'Supplier' }}

diff --git a/templates/Minimal.template.html b/templates/Minimal.template.html index e30ebfbc..feceea1e 100644 --- a/templates/Minimal.template.html +++ b/templates/Minimal.template.html @@ -35,7 +35,7 @@

- {{ doc.entryType === 'SalesInvoice' ? 'To' : 'From' }} + {{ doc.entryType.startsWith('Sales') ? 'To' : 'From' }}

{{ doc.party }}

- {{ doc.entryType === 'SalesInvoice' ? 'From' : 'To' }} + {{ doc.entryType.startsWith('Sales') ? 'From' : 'To' }}

{{ print.companyName }}