【发布时间】:2021-02-12 19:25:18
【问题描述】:
我正在自定义现有的 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");
});
【问题讨论】: