diff --git a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py index 87360543efd..0196b2b6189 100644 --- a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py +++ b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py @@ -668,7 +668,13 @@ class POSInvoice(SalesInvoice): "Account", self.debit_to, "account_currency" ) 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 4f0d6a64c36..8be04ab67a1 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -340,7 +340,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")