From 2b6b0b32a7abd5f1dab9468841e5c97e6f635126 Mon Sep 17 00:00:00 2001 From: Raffael Meyer <14891507+barredterra@users.noreply.github.com> Date: Tue, 19 Aug 2025 14:29:59 +0200 Subject: [PATCH] fix: set missing due date in Purchase Invoice and POS Invoice (#49232) (cherry picked from commit 77478303fefbb7246c66c125278a267a73d01961) --- erpnext/accounts/doctype/pos_invoice/pos_invoice.py | 8 +++++++- .../accounts/doctype/purchase_invoice/purchase_invoice.py | 7 ++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py index 80c4db50acb..51fb5730ed8 100644 --- a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py +++ b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py @@ -560,7 +560,13 @@ class POSInvoice(SalesInvoice): "Account", self.debit_to, "account_currency", cache=True ) if not self.due_date and self.customer: - self.due_date = get_due_date(self.posting_date, "Customer", self.customer, self.company) + self.due_date = get_due_date( + self.posting_date, + "Customer", + self.customer, + self.company, + template_name=self.payment_terms_template, + ) super(SalesInvoice, self).set_missing_values(for_validate) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index b0de69ed5cd..04ee0c821a7 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -173,7 +173,12 @@ class PurchaseInvoice(BuyingController): ) if not self.due_date: self.due_date = get_due_date( - self.posting_date, "Supplier", self.supplier, self.company, self.bill_date + self.posting_date, + "Supplier", + self.supplier, + self.company, + self.bill_date, + template_name=self.payment_terms_template, ) tds_category = frappe.db.get_value("Supplier", self.supplier, "tax_withholding_category")