refactor: validate due date code and message according to doctype (#45126)

* refactor: change message of date comparision and refactor code

* refactor: commonify function call for sales and purchase invoice

* refactor: remove redundant mandatory error validation
This commit is contained in:
Ejaaz Khan
2025-01-08 12:49:02 +05:30
committed by GitHub
parent 2b453219fc
commit 81d8f257aa
3 changed files with 45 additions and 36 deletions

View File

@@ -1037,6 +1037,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 &&