Hi,
I have created a custom field Fixed Credit Limit
and a child table Credit Limit History
which has a column named fixed_limit
under customer doctype.
Now I have created a custom script which fetches the value from parent doctype Fixed Credit Limit in every row in the child table. Now, If I change the value in parent field, then every row value gets changed. How do I prevent changing the previously fetched values in the rows? and make this script work for only the new rows?
The current script is like this:
function table_calc(frm) {
for ( let i in frm.doc.customer_credit_history){
frm.doc.customer_credit_history[i].fixed_limit = frm.doc.fixed_credit_limit;
}
frm.refresh_field("customer_credit_history");
}
frappe.ui.form.on("Customer Credit History", "customer_credit_history_add", table_calc);