mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-19 20:54:01 +00:00
fix: resolve pre-commit formatting and missing UOM in stock balance test
- Reformat generator expression in add_alt_uom_columns to satisfy ruff
line-length rule (pre-commit was auto-fixing this and failing CI)
- Create "Carton" UOM before use in test_alt_uom_balance_uses_first_alternate_uom
to avoid LinkValidationError when "Carton" doesn't exist in test DB
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
(cherry picked from commit 987f606b4d)
This commit is contained in:
@@ -614,7 +614,11 @@ class StockBalanceReport:
|
||||
return
|
||||
|
||||
bal_qty_idx = next(
|
||||
(i for i, col in enumerate(self.columns) if isinstance(col, dict) and col.get("fieldname") == "bal_qty"),
|
||||
(
|
||||
i
|
||||
for i, col in enumerate(self.columns)
|
||||
if isinstance(col, dict) and col.get("fieldname") == "bal_qty"
|
||||
),
|
||||
None,
|
||||
)
|
||||
if bal_qty_idx is None:
|
||||
|
||||
@@ -202,6 +202,7 @@ class TestStockBalance(ERPNextTestSuite):
|
||||
|
||||
def test_alt_uom_balance_uses_first_alternate_uom(self):
|
||||
"""When an item has multiple alt UOMs, only the first (lowest idx) is shown."""
|
||||
frappe.get_doc({"doctype": "UOM", "uom_name": "Carton"}).insert(ignore_if_duplicate=True)
|
||||
self.item.append("uoms", {"conversion_factor": 12, "uom": "Box"})
|
||||
self.item.append("uoms", {"conversion_factor": 144, "uom": "Carton"})
|
||||
self.item.save()
|
||||
|
||||
Reference in New Issue
Block a user