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

Co-authored-by: Raffael Meyer <14891507+barredterra@users.noreply.github.com>
fix(item): format integer numeric variant attributes without decimals (#55561)
This commit is contained in:
mergify[bot]
2026-06-02 23:00:04 +02:00
committed by GitHub
parent 6a1c384f9b
commit fffba84868

View File

@@ -935,11 +935,17 @@ $.extend(erpnext.item, {
if (!row.disabled) {
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}", [
frappe.format(row.from_range, { fieldtype: "Float" }, { always_show_decimals: true }),
frappe.format(row.to_range, { fieldtype: "Float" }, { always_show_decimals: true }),
frappe.format(row.increment, { fieldtype: "Float" }, { always_show_decimals: true }),
frappe.format(row.from_range, df, options),
frappe.format(row.to_range, df, options),
frappe.format(row.increment, df, options),
]);
} else {
fieldtype = "Data";