From e3d6d21ec5a04e50c37dc2824a114cc2c8e88b36 Mon Sep 17 00:00:00 2001 From: Shreya Shah Date: Mon, 27 Nov 2017 12:02:13 +0530 Subject: [PATCH] [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 --- .../doctype/production_order/production_order.py | 2 ++ erpnext/patches.txt | 3 ++- .../patches/v9_2/set_item_name_in_production_order.py | 11 +++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 erpnext/patches/v9_2/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 89ecbe7ec5..34ade1042d 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.py +++ b/erpnext/manufacturing/doctype/production_order/production_order.py @@ -441,6 +441,8 @@ class ProductionOrder(Document): 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 d58d73b175..6c27c8e40a 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -461,4 +461,5 @@ execute:frappe.delete_doc_if_exists("DocType", "Program Fee") 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 0000000000..e0e422b307 --- /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) + """)