Hi. @jof2jc, code you provided giving “SyntaxError: Invalid or unexpected token” error.
Now I am much confused between 3 ways to fetch value!
Please explain which method should use,
Why and
What is the difference.
(Searched everywhere but couldn’t find answer)
- New field "expiry_date as “Read Only” and in “Option” write “batch_no.expiry_date”
cur_frm.add_fetch(“batch_no”, “expiry_date”, “expiry_date”);Which Is working but has to edit batch no field to fetch Expiry date
A) You said:
cur_frm.add_fetch doesn’t work on child table.
B) Rushabh Mehta Said add_fetch does work for child tables!
C) He also said add_fetch won’t work with table type fields.
- Code you provided:
frappe.ui.form.on(“Sales Invoice Item”, “batch_no”, function (frm, cdt, cdn) {
var d = locals[cdt][cdn];frappe.db.get_value("batch", {"name": d.batch_no}, "expiry_date", function(value) { d.expiry_date = value.expiry_date; }) });
Thanks for support.