fix(item): format integer numeric variant attributes without decimals (#55561)

This commit is contained in:
Raffael Meyer
2026-06-02 22:42:32 +02:00
committed by GitHub
parent e94bd51764
commit 016b64df6d

View File

@@ -935,11 +935,17 @@ $.extend(erpnext.item, {
if (!row.disabled) { if (!row.disabled) {
if (row.numeric_values) { if (row.numeric_values) {
fieldtype = "Float"; const all_are_int =
flt(row.from_range) === cint(row.from_range) &&
flt(row.to_range) === cint(row.to_range) &&
flt(row.increment) === cint(row.increment);
fieldtype = all_are_int ? "Int" : "Float";
const df = { fieldtype };
const options = all_are_int ? { inline: 1 } : { always_show_decimals: true, inline: 1 };
desc = __("Min Value: {0}, Max Value: {1}, in Increments of: {2}", [ desc = __("Min Value: {0}, Max Value: {1}, in Increments of: {2}", [
frappe.format(row.from_range, { fieldtype: "Float" }, { always_show_decimals: true }), frappe.format(row.from_range, df, options),
frappe.format(row.to_range, { fieldtype: "Float" }, { always_show_decimals: true }), frappe.format(row.to_range, df, options),
frappe.format(row.increment, { fieldtype: "Float" }, { always_show_decimals: true }), frappe.format(row.increment, df, options),
]); ]);
} else { } else {
fieldtype = "Data"; fieldtype = "Data";