Hi,all i am trying to set due date based on delivery date and tern(i.e a static select Options like 3 days ,7 days …)
requirement is when i select “3 days” option the due date will be delivery date + 3 days.
when i select “7 days” option the due date will be delivery date + 7 days.
i am trying with this script… kindly give your suggestions it will help me to solve it.
@szufisher thanks for your response .
i want to update due date while selecting different term options…
i.e for 3 days-delivery date+ 3,
for 7 days-delivery date+ 7,
for 15 days-delivery date+ 15
Hi @shivansh13,
If you explain the problem or error you get, it might be clearer for someone here to help you.
And it is not clear whether you want the change to happen right away when you make the change or when the delivery date due (same date as today).
Aside of that, why are you not writting something like this:
if (doc.term == "3 Days") {
days = 3;
} else if (doc.term == "7 Days") {
days = 7;
} else if (doc.term == "15 Days") {
days = 15;
}
if (doc.delivery_date == frappe.datetime.get_today()) {
frm.set_value("due_date", frappe.datetime.add_days(frm.doc.delivery_date, days));