diff --git a/client/src/components/bill-form/bill-form.lines.component.jsx b/client/src/components/bill-form/bill-form.lines.component.jsx index fd565097d..73b0a21a9 100644 --- a/client/src/components/bill-form/bill-form.lines.component.jsx +++ b/client/src/components/bill-form/bill-form.lines.component.jsx @@ -90,6 +90,7 @@ export function BillEnterModalLinesComponent({ }); }; + // Only fill actual_cost when the user forward-tabs out of Retail (actual_price) const autofillActualCost = (index) => { Promise.resolve().then(() => { const retailRaw = form.getFieldValue(["billlines", index, "actual_price"]); @@ -164,10 +165,9 @@ export function BillEnterModalLinesComponent({ }} allowRemoved={form.getFieldValue("is_credit_memo") || false} onSelect={(value, opt) => { - const d = normalizeDiscount(discount); - const retail = Number(opt.cost); - const computedActual = Number.isFinite(retail) ? round2(retail * (1 - d)) : null; - + // IMPORTANT: + // Do NOT autofill actual_cost here. It should only fill when the user forward-tabs + // from Retail (actual_price) -> Actual Cost (actual_cost). setFieldsValue({ billlines: (getFieldValue("billlines") || []).map((item, idx) => { if (idx !== index) return item; @@ -178,7 +178,7 @@ export function BillEnterModalLinesComponent({ quantity: opt.part_qty || 1, actual_price: opt.cost, original_actual_price: opt.cost, - actual_cost: isBlank(item.actual_cost) ? computedActual : item.actual_cost, + // actual_cost intentionally untouched here cost_center: opt.part_type ? bodyshopHasDmsKey(bodyshop) ? opt.part_type !== "PAE" @@ -251,10 +251,9 @@ export function BillEnterModalLinesComponent({ autofillActualCost(index)} + // NOTE: Autofill should only happen on forward Tab out of Retail onKeyDown={(e) => { - if (e.key === "Tab") autofillActualCost(index); + if (e.key === "Tab" && !e.shiftKey) autofillActualCost(index); }} /> ), @@ -330,10 +329,7 @@ export function BillEnterModalLinesComponent({ disabled={disabled} controls={false} style={{ width: "100%", height: CONTROL_HEIGHT }} - // TODO: Removed at customers request - // NOTE: onFocus autofill behavior disabled per user request (revert to tab-only behavior) - // This can be re-enabled as a user preference in the future - // onFocus={() => autofillActualCost(index)} + // NOTE: No auto-fill on focus/blur; only triggered from Retail on Tab />