These error is from WebSocket, nothing to worry at all!
You environment is not properly configured!
The most important is: The code works on Edge?
These error is from WebSocket, nothing to worry at all!
You environment is not properly configured!
The most important is: The code works on Edge?
It does not. What’s wrong with the environment?
@Eli, The script from that thread works when I make the Quotemaster Area a master doctype instead of a child table. however, it does not work as a child table.
frappe.ui.form.on("Quotemaster Area", "wid", function(frm) {
cur_frm.set_value("area", (frm.doc.wid * frm.doc.len));
msgprint(frm.doc.wid);
});
frappe.ui.form.on("Quotemaster Area", "len", function(frm) {
cur_frm.set_value("area", (frm.doc.wid * frm.doc.len));
msgprint(frm.doc.len);
});
frappe.ui.form.on("Quotemaster Area", "area", function(frm) {
cur_frm.set_value("area", (frm.doc.wid * frm.doc.len));
msgprint(frm.doc.area);
});
@max_morais_dmm The following code also works when it’s a master doctype:
frappe.ui.form.on("Quotemaster Area", "len", function(frm, cdt, cdn){
var d = locals[cdt][cdn];
frappe.model.set_value(d.doctype, d.name, "area", d.len * d.wid);
frm.fields_dict["area"].grid.grid_rows_by_docname[cdn].area.refresh();
});
frappe.ui.form.on("Quotemaster Area", "wid", function(frm, cdt, cdn){
var d = locals[cdt][cdn];
frappe.model.set_value(d.doctype, d.name, "area", d.len * d.wid);
frm.fields_dict["area"].grid.grid_rows_by_docname[cdn].area.refresh();
});
Even the very first formula I tried works now:
// add a trigger on field "len"
cur_frm.cscript.len = function(doc, cdt, cdn) {
// update a new field "area"
doc.area = flt(doc.len)*flt(doc.wid);
// refresh in form
refresh_field('area');
}
// add the same trigger on "wid"
cur_frm.cscript.wid = cur_frm.cscript.len;
@cpurbaugh, In my case this worked even keeping the doctype as child table
frappe.ui.form.on(“Packing Materials”, “ordered”, function(frm,cdt,cdn) {
var d = locals[cdt][cdn];
frappe.model.set_value(d.doctype, d.name, “amount”, d.rate * d.ordered);
frm.fields_dict[“amount”].grid.grid_rows_by_docname[cdn].amount.refresh();
alert(frm.doc.amount);
});