test: basic item and wh capacity dashboard tests
diff --git a/erpnext/stock/dashboard/item_dashboard.py b/erpnext/stock/dashboard/item_dashboard.py
index 57d78a2..75aa1d3 100644
--- a/erpnext/stock/dashboard/item_dashboard.py
+++ b/erpnext/stock/dashboard/item_dashboard.py
@@ -40,18 +40,15 @@
filters=filters,
order_by=sort_by + ' ' + sort_order,
limit_start=start,
- limit_page_length='21')
+ limit_page_length=21)
precision = cint(frappe.db.get_single_value("System Settings", "float_precision"))
for item in items:
item.update({
- 'item_name': frappe.get_cached_value(
- "Item", item.item_code, 'item_name'),
- 'disable_quick_entry': frappe.get_cached_value(
- "Item", item.item_code, 'has_batch_no')
- or frappe.get_cached_value(
- "Item", item.item_code, 'has_serial_no'),
+ 'item_name': frappe.get_cached_value("Item", item.item_code, 'item_name'),
+ 'disable_quick_entry': frappe.get_cached_value( "Item", item.item_code, 'has_batch_no')
+ or frappe.get_cached_value( "Item", item.item_code, 'has_serial_no'),
'projected_qty': flt(item.projected_qty, precision),
'reserved_qty': flt(item.reserved_qty, precision),
'reserved_qty_for_production': flt(item.reserved_qty_for_production, precision),
diff --git a/erpnext/stock/doctype/item/test_item.py b/erpnext/stock/doctype/item/test_item.py
index 112420f..05e6e76 100644
--- a/erpnext/stock/doctype/item/test_item.py
+++ b/erpnext/stock/doctype/item/test_item.py
@@ -685,6 +685,12 @@
# standalone return
make_purchase_receipt(is_return=True, qty=-1, **typical_args)
+ def test_item_dashboard(self):
+ from erpnext.stock.dashboard.item_dashboard import get_data
+
+ self.assertTrue(get_data(item_code="_Test Item"))
+ self.assertTrue(get_data(warehouse="_Test Warehouse - _TC"))
+ self.assertTrue(get_data(item_group="All Item Groups"))
def set_item_variant_settings(fields):
diff --git a/erpnext/stock/doctype/putaway_rule/test_putaway_rule.py b/erpnext/stock/doctype/putaway_rule/test_putaway_rule.py
index 4e8d71f..0ec812c 100644
--- a/erpnext/stock/doctype/putaway_rule/test_putaway_rule.py
+++ b/erpnext/stock/doctype/putaway_rule/test_putaway_rule.py
@@ -396,6 +396,21 @@
rule_1.delete()
rule_2.delete()
+ def test_warehouse_capacity_dashbord(self):
+ from erpnext.stock.dashboard.warehouse_capacity_dashboard import get_data
+
+ item = "_Rice"
+ rule = create_putaway_rule(item_code=item, warehouse=self.warehouse_1, capacity=500,
+ uom="Kg")
+
+ capacities = get_data(warehouse=self.warehouse_1)
+ for capacity in capacities:
+ if capacity.item_code == item and capacity.warehouse == self.warehouse_1:
+ self.assertEqual(capacity.stock_capacity, 500)
+
+ get_data(warehouse=self.warehouse_1)
+ rule.delete()
+
def create_putaway_rule(**args):
args = frappe._dict(args)
putaway = frappe.new_doc("Putaway Rule")