I have a general question regarding my vs code environment.
I am using WSL v2 and everything runs smoothly, just the red underlines that indicates error and Frappe not defined.
The editor suggest to ignore them using: // @ts-ignore , however, it’s not a solution.
NCP
August 10, 2023, 9:11am
2
Hi @Omar_M_K_Shehada ,
Code is right.
Please check it syntax.
frappe.ui.form.on('Your Child Table', {
field_name_for_trigger: function(frm, cdt, cdn) {
var row = local[cdt][cdn];
// Your Code
}
});
// Example:
frappe.ui.form.on('Sales Order Item', {
qty: function(frm, cdt, cdn) {
var row = local[cdt][cdn];
frappe.model.set_value(cdt, cdn, 'custom_total_field', row.qty * row.rate);
}
});
More reference for:
Hi @NinYo ,
Please apply it.
frappe.ui.form.on("Appraisal Template - Performance", {
p_rating: function(frm,cdt,cdn) {
var d = locals[cdt][cdn];
frappe.model.set_value(cdt, cdn, 'p_score1', (d.p_rating + d.p_weight));
}
});
// Syntax
frappe.ui.form.on("Child Table Name", {
field_name_for_trigger_to_value_calculate: function(frm,cdt,cdn) {
var d = locals[cdt][cdn];
frappe.model.set_value(cdt, cdn, 'child_table_total_value', (d.child_table_value1 + d.c…
I hope this helps.
Thank You!
Thank you for responding. I have no issue with the code it self, I just want to adjust the vs code to recognize Frappe and its keywords.