fix: item stock levels displaying inconsistently (#25506)
* fix: fixed stock levels dashboard not displaying after any interactions
* fix: minor translation fix
diff --git a/erpnext/stock/doctype/item/item.js b/erpnext/stock/doctype/item/item.js
index 2079cf8..8aec893 100644
--- a/erpnext/stock/doctype/item/item.js
+++ b/erpnext/stock/doctype/item/item.js
@@ -46,9 +46,6 @@
}, __("View"));
}
- if (!frm.doc.is_fixed_asset) {
- erpnext.item.make_dashboard(frm);
- }
if (frm.doc.is_fixed_asset) {
frm.trigger('is_fixed_asset');
@@ -96,6 +93,10 @@
erpnext.item.edit_prices_button(frm);
erpnext.item.toggle_attributes(frm);
+
+ if (!frm.doc.is_fixed_asset) {
+ erpnext.item.make_dashboard(frm);
+ }
frm.add_custom_button(__('Duplicate'), function() {
var new_item = frappe.model.copy_doc(frm.doc);
@@ -473,11 +474,15 @@
me.multiple_variant_dialog.get_primary_btn().html(__('Create Variants'));
me.multiple_variant_dialog.disable_primary_action();
} else {
+
let no_of_combinations = lengths.reduce((a, b) => a * b, 1);
- me.multiple_variant_dialog.get_primary_btn()
- .html(__(
- `Make ${no_of_combinations} Variant${no_of_combinations === 1 ? '' : 's'}`
- ));
+ let msg;
+ if (no_of_combinations === 1) {
+ msg = __("Make {0} Variant", [no_of_combinations]);
+ } else {
+ msg = __("Make {0} Variants", [no_of_combinations]);
+ }
+ me.multiple_variant_dialog.get_primary_btn().html(msg);
me.multiple_variant_dialog.enable_primary_action();
}
}