mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-16 10:20:31 +00:00
* refactor: add category field to uom (#54290)
(cherry picked from commit e04a2e6da2)
# Conflicts:
# erpnext/patches.txt
* chore: resolve conflicts
---------
Co-authored-by: Mihir Kandoi <kandoimihir@gmail.com>
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
"common_code",
|
||||
"description",
|
||||
"column_break_obth",
|
||||
"category",
|
||||
"enabled",
|
||||
"must_be_whole_number"
|
||||
],
|
||||
@@ -60,12 +61,21 @@
|
||||
{
|
||||
"fieldname": "column_break_obth",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"allow_in_quick_entry": 1,
|
||||
"fieldname": "category",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"in_standard_filter": 1,
|
||||
"label": "Category",
|
||||
"options": "UOM Category"
|
||||
}
|
||||
],
|
||||
"icon": "fa fa-compass",
|
||||
"idx": 1,
|
||||
"links": [],
|
||||
"modified": "2025-08-21 18:59:27.900209",
|
||||
"modified": "2026-04-14 21:20:16.983514",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Setup",
|
||||
"name": "UOM",
|
||||
|
||||
@@ -14,6 +14,7 @@ class UOM(Document):
|
||||
if TYPE_CHECKING:
|
||||
from frappe.types import DF
|
||||
|
||||
category: DF.Link | None
|
||||
common_code: DF.Data | None
|
||||
description: DF.SmallText | None
|
||||
enabled: DF.Check
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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")},
|
||||
|
||||
Reference in New Issue
Block a user