Try ERPNext Buy Support Partners Foundation Foundation Members

DN Posting date

Hello Dears.

we need to change posting date to be automatically next date

and we have done this in sales order and works fine by that way

frappe.ui.form.on("Delivery Note", "onload", function(frm, cdt, cdn){
  if (moment().format('dddd') == 'Thursday'){ 
		frm.set_value("posting_date", frappe.datetime.add_days(frappe.datetime.nowdate(), 3));
	} else {
		frm.set_value("posting_date", frappe.datetime.add_days(frappe.datetime.nowdate(), 1));
	}
})

but in Delivery note it works only onload but when i save th form it come back to Today

whats the issue ??

@Mahmoud_Ghoneem

Add this much part of code on onload function after setting the value of posting_date frm.set_value(“set_posting_time”, 1);

1 Like