heres my code:
.py
@frappe.whitelist()
def get_item_duration(item,starts_on):
it= frappe.get_doc(“Item”,item)
frappe.errprint(it.duration)
temp = datetime.strptime(starts_on, “%Y-%m-%d %H:%M:%S”)end =temp + timedelta(minutes = it.duration)
return end
.js
starts_on: function(doc, cdt, cdn){
var d = locals[cdt][cdn];
if(!d.item){
console.log(“no item”);
msgprint(“enter item”);
}
else{
var duration = frappe.model.get_value(“Item”,d.item, duration);
console.log(duration);frappe.call({ method: "appointment.appointment_manager.doctype.appointment.appointment.get_item_duration", args: { "item": d.item, "starts_on": d.starts_on }, callback: function(r) { if(r.message) { console.log("item duration"); //date = frappe.datetime.now_time(); //cur_frm.set_value("ends_on", frappe.datetime.now_time()); cur_frm.set_value(d.ends_on,r.message); cur_frm.refresh_field(d.ends_on); console.log(r.message); } } }); }
}
but the value does not get set, also tried with frm.set_value ,doc.set_value
but no luck,
both these fields are in child table.
i am getting proper response and date in r.message.
What could be the reason
Thanks,