Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: broken UOM auto complete (backport #29242) #29243

Merged
merged 2 commits into from
Jan 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions erpnext/controllers/tests/test_queries.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import unittest
from functools import partial

import frappe

from erpnext.controllers import queries


Expand Down Expand Up @@ -85,3 +87,6 @@ def test_warehouse_query(self):

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)
1 change: 1 addition & 0 deletions erpnext/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ erpnext.patches.v13_0.enable_scheduler_job_for_item_reposting
erpnext.patches.v13_0.requeue_failed_reposts
erpnext.patches.v13_0.fetch_thumbnail_in_website_items
erpnext.patches.v13_0.update_job_card_status
erpnext.patches.v13_0.enable_uoms
erpnext.patches.v12_0.update_production_plan_status
erpnext.patches.v13_0.item_naming_series_not_mandatory
erpnext.patches.v13_0.update_category_in_ltds_certificate
Expand Down
13 changes: 13 additions & 0 deletions erpnext/patches/v13_0/enable_uoms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import frappe


def execute():
frappe.reload_doc('setup', 'doctype', 'uom')

uom = frappe.qb.DocType("UOM")

(frappe.qb
.update(uom)
.set(uom.enabled, 1)
.where(uom.creation >= "2021-10-18") # date when this field was released
).run()
3 changes: 2 additions & 1 deletion erpnext/setup/setup_wizard/operations/install_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,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
Expand Down