From 0b0a6b8cfa65a40dc5cba57a6d739a336130acb0 Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Tue, 8 Apr 2025 20:12:25 +0200 Subject: [PATCH] feat: update due date in payment schedule Partial backport of b629356b7c9f9ef1c846ab6e4fdc53c81173a64d --- erpnext/public/js/controllers/transaction.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index 8e90853ad06..cbd80a3c45f 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -1042,6 +1042,14 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe due_date() { // due_date is to be changed, payment terms template and/or payment schedule must // be removed as due_date is automatically changed based on payment terms + + // if there is only one row in payment schedule child table, set its due date as the due date + if (this.frm.doc.payment_schedule.length == 1){ + this.frm.doc.payment_schedule[0].due_date = this.frm.doc.due_date; + this.frm.refresh_field("payment_schedule"); + return + } + if ( this.frm.doc.due_date && !this.frm.updating_party_details &&