fix(vat): run the recompute once after the report-fill (dövr) settles
Selecting dövr triggers populate_vat_tables + formula_editor, which fill leaf cells from reports but do not roll parents up (e.g. 301.1 = Σ 301.1.1..4). The per-write recompute is suppressed during that storm; previously nothing ran afterwards, so 301.1 (and other roll-ups / appendix→turnover passthrough) stayed stale. Now "fill mode" runs the recompute ONCE, 3s after the fill settles. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
67f258daf0
commit
26e72c253e
|
|
@ -284,18 +284,25 @@ function vc_recompute(frm) {
|
||||||
frm.refresh_field("sertifikathesabatdövründəmalındəyərininsəhifəsicəmi");
|
frm.refresh_field("sertifikathesabatdövründəmalındəyərininsəhifəsicəmi");
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Suppress recompute during the report-fill storm (populate_vat_tables / formula_editor
|
// --- Suppress the per-write recompute during the report-fill storm (populate_vat_tables /
|
||||||
// write hundreds of cells via set_value; recomputing on each would freeze the UI and
|
// formula_editor write hundreds of cells via set_value; recomputing on each would freeze
|
||||||
// clobber report values). "Fill mode" starts on period change and re-arms on every
|
// the UI). "Fill mode" starts on period change and re-arms on every programmatic write.
|
||||||
// programmatic write, ending 3s after the fill settles. User edits are debounced. ---
|
// 3s after the fill settles it runs the recompute ONCE, so roll-ups / passthrough
|
||||||
var vc_fill_mode = false, vc_fill_timer = null, vc_calc_timer = null;
|
// (e.g. 301.1 = Σ children, turnover ← appendices) fill in from the report data.
|
||||||
function vc_mark_fill() {
|
// User edits (outside fill mode) are debounced. ---
|
||||||
|
var vc_fill_mode = false, vc_fill_timer = null, vc_calc_timer = null, vc_frm = null;
|
||||||
|
function vc_mark_fill(frm) {
|
||||||
|
if (frm) vc_frm = frm;
|
||||||
vc_fill_mode = true;
|
vc_fill_mode = true;
|
||||||
if (vc_fill_timer) clearTimeout(vc_fill_timer);
|
if (vc_fill_timer) clearTimeout(vc_fill_timer);
|
||||||
vc_fill_timer = setTimeout(function () { vc_fill_mode = false; }, 3000);
|
vc_fill_timer = setTimeout(function () {
|
||||||
|
vc_fill_mode = false;
|
||||||
|
if (vc_frm) vc_recompute(vc_frm); // one recompute after the report-fill settles
|
||||||
|
}, 3000);
|
||||||
}
|
}
|
||||||
function vc_onchange(frm) {
|
function vc_onchange(frm) {
|
||||||
if (vc_fill_mode) { vc_mark_fill(); return; } // ignore fill writes
|
vc_frm = frm;
|
||||||
|
if (vc_fill_mode) { vc_mark_fill(frm); return; } // during fill: extend window, no per-write recompute
|
||||||
if (vc_calc_timer) clearTimeout(vc_calc_timer);
|
if (vc_calc_timer) clearTimeout(vc_calc_timer);
|
||||||
vc_calc_timer = setTimeout(function () { vc_recompute(frm); }, 300); // debounce user edits
|
vc_calc_timer = setTimeout(function () { vc_recompute(frm); }, 300); // debounce user edits
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue