Auto-fill date fields from other date field

Is there a way to populate a custom date field based on the value of another date field?

Say I have a Delivery Date of 10/03/15 and I want to have a production stage due 3 days before that. So I want to write logic to say populate “Production Date” with Delivery Date - 3 days.

Or even better I use a custom field of “Production Lead Time” and it’s a number - then I use the logic:

Production Date = Delivery Date - Production Lead Time

as my custom script.

Anyone done similar to this?

Anyone? I found this on github but it doesn’t seem to work:

Should be an easy enough script to setup.

Try frappe.datetime.add_days

You can also use momentjs (http://momentjs.com/) (its included in frappe)

1 Like

@rmehta spot on that works, in fact @max_morais_dmm assisted me on gitter recently to get this working too :slight_smile: