tüit Logo Direkt zum Hauptinhalt

Datumsfelder füllen


frappe.ui.form.on('Sales Order', {
    performance_period_start: function(frm,cdt,cdn){
        if (frm.doc.performance_period_start) {
            var end_date = frappe.datetime.add_days(frm.doc.performance_period_start, 364);
            frappe.model.set_value(cdt,cdn,"performance_period_end",end_date);
            for (var i =0; i < frm.doc.items.length; i++){
              frm.doc.items[i].start_date = frm.doc.performance_period_start;
              frm.doc.items[i].end_date = frm.doc.performance_period_end;
            }
        }
    }
});

frappe.ui.form.on('Sales Order Item', {
    start_date: function(frm,cdt,cdn){
            var d = locals[cdt][cdn];
            if (d.start_date) {
                var end_date = frappe.datetime.add_days(d.start_date, 364); 
                frappe.model.set_value(cdt,cdn,"end_date",end_date); 
                } 
            }
    });