From 33aad4b950045d90eb4505274fd8d504776608a8 Mon Sep 17 00:00:00 2001 From: Ankush Menat Date: Tue, 11 Jan 2022 17:06:31 +0530 Subject: [PATCH] fix: UOM autocomplete broken All new recent sites seem to have all UOMs as disabled by default. The desired behaviour is exact opposite of this. --- erpnext/controllers/tests/test_queries.py | 5 +++++ erpnext/setup/setup_wizard/operations/install_fixtures.py | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/erpnext/controllers/tests/test_queries.py b/erpnext/controllers/tests/test_queries.py index 05541d1688..908d78c15b 100644 --- a/erpnext/controllers/tests/test_queries.py +++ b/erpnext/controllers/tests/test_queries.py @@ -1,6 +1,8 @@ import unittest from functools import partial +import frappe + from erpnext.controllers import queries @@ -85,3 +87,6 @@ class TestQueries(unittest.TestCase): wh = query(filters=[["Bin", "item_code", "=", "_Test Item"]]) self.assertGreaterEqual(len(wh), 1) + + def test_default_uoms(self): + self.assertGreaterEqual(frappe.db.count("UOM", {"enabled": 1}), 10) diff --git a/erpnext/setup/setup_wizard/operations/install_fixtures.py b/erpnext/setup/setup_wizard/operations/install_fixtures.py index 336b51c0ab..9dbf49eae7 100644 --- a/erpnext/setup/setup_wizard/operations/install_fixtures.py +++ b/erpnext/setup/setup_wizard/operations/install_fixtures.py @@ -353,7 +353,8 @@ def add_uom_data(): "doctype": "UOM", "uom_name": _(d.get("uom_name")), "name": _(d.get("uom_name")), - "must_be_whole_number": d.get("must_be_whole_number") + "must_be_whole_number": d.get("must_be_whole_number"), + "enabled": 1, }).db_insert() # bootstrap uom conversion factors