From ee647f2381b2849fb26b5b555eaf3438bc4897ee Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 21 Nov 2024 14:52:18 +0530 Subject: [PATCH] fix: added Stock UOM field for RM in work order (backport #44185) (#44236) * fix: added Stock UOM field for RM in work order (#44185) fix: added UOM field for RM in work order (cherry picked from commit cc571aca8f56310b7f87244ebdbdb91fd6b57222) # Conflicts: # erpnext/manufacturing/doctype/work_order_item/work_order_item.json # erpnext/manufacturing/doctype/work_order_item/work_order_item.py # erpnext/patches.txt * chore: fix conflicts * chore: fix conflicts * chore: fix conflicts --------- Co-authored-by: rohitwaghchaure --- .../doctype/work_order_item/work_order_item.json | 13 +++++++++++-- erpnext/patches.txt | 1 + .../v14_0/update_stock_uom_in_work_order_item.py | 15 +++++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 erpnext/patches/v14_0/update_stock_uom_in_work_order_item.py diff --git a/erpnext/manufacturing/doctype/work_order_item/work_order_item.json b/erpnext/manufacturing/doctype/work_order_item/work_order_item.json index 0f4d693544e..580168180a7 100644 --- a/erpnext/manufacturing/doctype/work_order_item/work_order_item.json +++ b/erpnext/manufacturing/doctype/work_order_item/work_order_item.json @@ -15,6 +15,7 @@ "include_item_in_manufacturing", "qty_section", "required_qty", + "stock_uom", "rate", "amount", "column_break_11", @@ -138,11 +139,19 @@ "in_list_view": 1, "label": "Returned Qty ", "read_only": 1 + }, + { + "fetch_from": "item_code.stock_uom", + "fieldname": "stock_uom", + "fieldtype": "Link", + "label": "Stock UOM", + "options": "UOM", + "read_only": 1 } ], "istable": 1, "links": [], - "modified": "2024-02-11 15:45:32.318374", + "modified": "2024-11-19 15:48:16.823384", "modified_by": "Administrator", "module": "Manufacturing", "name": "Work Order Item", @@ -153,4 +162,4 @@ "sort_order": "DESC", "states": [], "track_changes": 1 -} \ No newline at end of file +} diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 4c5094b2fd2..8cc7ada03c2 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -367,3 +367,4 @@ erpnext.patches.v14_0.delete_orphaned_asset_movement_item_records erpnext.patches.v14_0.remove_cancelled_asset_capitalization_from_asset erpnext.patches.v14_0.enable_set_priority_for_pricing_rules #1 erpnext.patches.v14_0.update_currency_exchange_settings_for_frankfurter +erpnext.patches.v14_0.update_stock_uom_in_work_order_item diff --git a/erpnext/patches/v14_0/update_stock_uom_in_work_order_item.py b/erpnext/patches/v14_0/update_stock_uom_in_work_order_item.py new file mode 100644 index 00000000000..d611065d8f1 --- /dev/null +++ b/erpnext/patches/v14_0/update_stock_uom_in_work_order_item.py @@ -0,0 +1,15 @@ +import frappe + + +def execute(): + frappe.db.sql( + """ + UPDATE + `tabWork Order Item`, `tabItem` + SET + `tabWork Order Item`.stock_uom = `tabItem`.stock_uom + WHERE + `tabWork Order Item`.item_code = `tabItem`.name + AND `tabWork Order Item`.docstatus = 1 + """ + )