refactor: add category field to uom (#54290)

This commit is contained in:
Mihir Kandoi
2026-04-16 14:33:12 +05:30
committed by GitHub
parent 97efd51fb8
commit e04a2e6da2
7 changed files with 547 additions and 249 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -390,6 +390,9 @@ def add_uom_data():
open(frappe.get_app_path("erpnext", "setup", "setup_wizard", "data", "uom_data.json")).read()
)
for d in uoms:
if d.get("category") and not frappe.db.exists("UOM Category", d.get("category")):
frappe.get_doc({"doctype": "UOM Category", "category_name": d.get("category")}).db_insert()
if not frappe.db.exists("UOM", d.get("uom_name")):
doc = frappe.new_doc("UOM")
doc.update(d)
@@ -402,9 +405,6 @@ def add_uom_data():
).read()
)
for d in uom_conversions:
if not frappe.db.exists("UOM Category", d.get("category")):
frappe.get_doc({"doctype": "UOM Category", "category_name": d.get("category")}).db_insert()
if not frappe.db.exists(
"UOM Conversion Factor",
{"from_uom": d.get("from_uom"), "to_uom": d.get("to_uom")},