From 8406720a7ad6c38b067f5cd685e3f61570ee03e6 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 26 Dec 2018 12:28:37 +0530 Subject: [PATCH] [Fix] Patch rename_bom_wo_fields --- .../manufacturing/doctype/bom_item/bom_item.json | 2 +- erpnext/patches/v11_0/rename_bom_wo_fields.py | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/erpnext/manufacturing/doctype/bom_item/bom_item.json b/erpnext/manufacturing/doctype/bom_item/bom_item.json index b520360304..8a380f755b 100644 --- a/erpnext/manufacturing/doctype/bom_item/bom_item.json +++ b/erpnext/manufacturing/doctype/bom_item/bom_item.json @@ -1121,7 +1121,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2018-11-22 15:04:55.187136", + "modified": "2018-12-26 15:04:56.187136", "modified_by": "Administrator", "module": "Manufacturing", "name": "BOM Item", diff --git a/erpnext/patches/v11_0/rename_bom_wo_fields.py b/erpnext/patches/v11_0/rename_bom_wo_fields.py index 43fbea5ea7..c8106a6bd5 100644 --- a/erpnext/patches/v11_0/rename_bom_wo_fields.py +++ b/erpnext/patches/v11_0/rename_bom_wo_fields.py @@ -8,7 +8,19 @@ from frappe.model.utils.rename_field import rename_field def execute(): for doctype in ['BOM Explosion Item', 'BOM Item', 'Work Order Item', 'Item']: if frappe.db.has_column(doctype, 'allow_transfer_for_manufacture'): - rename_field('BOM Item', "allow_transfer_for_manufacture", "include_item_in_manufacturing") + if doctype != 'Item': + frappe.reload_doc('manufacturing', 'doctype', frappe.scrub(doctype)) + else: + frappe.reload_doc('stock', 'doctype', frappe.scrub(doctype)) + + rename_field(doctype, "allow_transfer_for_manufacture", "include_item_in_manufacturing") + + if frappe.db.has_column('BOM', 'allow_same_item_multiple_times'): + frappe.db.sql(""" UPDATE tabBOM + SET + allow_same_item_multiple_times = 0 + WHERE + trim(coalesce(allow_same_item_multiple_times, '')) = '' """) for doctype in ['BOM', 'Work Order']: frappe.reload_doc('manufacturing', 'doctype', frappe.scrub(doctype))