ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

DN Posting date


#1

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 ??


#2

@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);