mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-04 12:49:10 +00:00
fix(item): format integer numeric variant attributes without decimals (#55561)
This commit is contained in:
@@ -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";
|
||||||
|
|||||||
Reference in New Issue
Block a user