我正在自定义一个现有的 DocType(quotation),并且我已经向Quotation Item
子表中添加了影响amount
项目字段的字段。默认情况下,即在自定义之前,grand_total 和 Quotation net_totals 会在项目更改时立即计算。但是现在我有了自定义字段,我怎么能调用假设的“刷新”函数来进行默认计算呢?
这是我当前的自定义脚本,用于更新Quotation Item
子表上的项目数量:
frappe.ui.form.on("Quotation Item", "paint", function(frm, doctype, name) {
let row = locals[doctype][name];
let rate = row.labour + row.trim + row.paint + row.spares;
row.rate = rate;
let total = rate * row.qty
row.amount = total;
refresh_field("items");
});