[Fix] Item name and description in production order (#11723)
* fetch item name and description from bom
* Update production_order.py
* patch added
* Update set_item_name_in_production_order.py
diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py
index 89ecbe7..34ade10 100644
--- a/erpnext/manufacturing/doctype/production_order/production_order.py
+++ b/erpnext/manufacturing/doctype/production_order/production_order.py
@@ -441,6 +441,8 @@
for item in sorted(item_dict.values(), key=lambda d: d['idx']):
self.append('required_items', {
'item_code': item.item_code,
+ 'item_name': item.item_name,
+ 'description': item.description,
'required_qty': item.qty,
'source_warehouse': item.source_warehouse or item.default_warehouse
})
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index d58d73b..6c27c8e 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -461,4 +461,5 @@
erpnext.patches.v9_0.update_employee_loan_details
erpnext.patches.v9_2.delete_healthcare_domain_default_items
erpnext.patches.v9_2.rename_translated_domains_in_en
-erpnext.patches.v9_2.repost_reserved_qty_for_production
\ No newline at end of file
+erpnext.patches.v9_2.repost_reserved_qty_for_production
+erpnext.patches.v9_2.set_item_name_in_production_order
\ No newline at end of file
diff --git a/erpnext/patches/v9_2/set_item_name_in_production_order.py b/erpnext/patches/v9_2/set_item_name_in_production_order.py
new file mode 100644
index 0000000..e0e422b
--- /dev/null
+++ b/erpnext/patches/v9_2/set_item_name_in_production_order.py
@@ -0,0 +1,11 @@
+import frappe
+
+def execute():
+
+ frappe.db.sql("""
+ update `tabBOM Item` bom, `tabProduction Order Item` po_item
+ set po_item.item_name = bom.item_name,
+ po_item.description = bom.description
+ where po_item.item_code = bom.item_code
+ and (po_item.item_name is null or po_item.description is null)
+ """)