refactor: create UOMs during setup
diff --git a/erpnext/setup/setup_wizard/operations/install_fixtures.py b/erpnext/setup/setup_wizard/operations/install_fixtures.py
index 2205924..0d82217 100644
--- a/erpnext/setup/setup_wizard/operations/install_fixtures.py
+++ b/erpnext/setup/setup_wizard/operations/install_fixtures.py
@@ -336,16 +336,10 @@
open(frappe.get_app_path("erpnext", "setup", "setup_wizard", "data", "uom_data.json")).read()
)
for d in uoms:
- if not frappe.db.exists("UOM", _(d.get("uom_name"))):
- frappe.get_doc(
- {
- "doctype": "UOM",
- "uom_name": _(d.get("uom_name")),
- "name": _(d.get("uom_name")),
- "must_be_whole_number": d.get("must_be_whole_number"),
- "enabled": 1,
- }
- ).db_insert()
+ if not frappe.db.exists("UOM", d.get("uom_name")):
+ doc = frappe.new_doc("UOM")
+ doc.update(d)
+ doc.save()
# bootstrap uom conversion factors
uom_conversions = json.loads(
@@ -359,14 +353,14 @@
if not frappe.db.exists(
"UOM Conversion Factor",
- {"from_uom": _(d.get("from_uom")), "to_uom": _(d.get("to_uom"))},
+ {"from_uom": d.get("from_uom"), "to_uom": d.get("to_uom")},
):
frappe.get_doc(
{
"doctype": "UOM Conversion Factor",
"category": _(d.get("category")),
- "from_uom": _(d.get("from_uom")),
- "to_uom": _(d.get("to_uom")),
+ "from_uom": d.get("from_uom"),
+ "to_uom": d.get("to_uom"),
"value": d.get("value"),
}
).db_insert()