can someone plz help to write a custom script that should be added to a sales order.
i placed a checkbox named “No Delivery Date”, so if this box is checked, the delivery date should directly fill up with the following date for example: 01-01-2020.
so how should i write this?
@Perla i think giving hard coded value is not possible for Date type fields,
You can try below script to set date when checkbox is checked, this script will assign 5 days later value on delivery date according to transaction date.
For Ex : Transaction Date is 01/10/2018, it will assign 10/06/2018 to delivery date.
frappe.ui.form.on("Sales Order",{
no_delivery_date: function(frm){
set_date(frm);
}
});
var set_date = function(frm)
{
if(frm.doc.no_delivery_date == 1){
frm.set_value("delivery_date", frappe.datetime.add_days(frm.doc.transaction_date, 5));
}
}
1 Like