Automatically set Delivery Date

HI all-
Even though I have set delivery date as not mandatory on the sales order item child table, it still makes me enter it before I can save. In order to avoid this, I would like to set this date automatically based on 4 days after the ship date, which is already on the sales order.

How can I achieve this using ERPNext Cloud version?

Thanks-
Heather

You can create a custom script that calculate the delivery date based on ship date like that:

 frappe.ui.form.on("Sales Order", "ship_date", function(frm) {
   var delivery_date = frappe.datetime.add_days(frm.doc.ship_date, 4); 
   frm.set_value("delivery_date", delivery_date);
 });

hope this helps,

4 Likes

Thanks @ahmed-madi