[Fix] Patch rename_bom_wo_fields

This commit is contained in:
Rohit Waghchaure 2018-12-26 12:28:37 +05:30
parent 136c4c4820
commit 8406720a7a
2 changed files with 14 additions and 2 deletions

View File

@ -1121,7 +1121,7 @@
"issingle": 0, "issingle": 0,
"istable": 1, "istable": 1,
"max_attachments": 0, "max_attachments": 0,
"modified": "2018-11-22 15:04:55.187136", "modified": "2018-12-26 15:04:56.187136",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Manufacturing", "module": "Manufacturing",
"name": "BOM Item", "name": "BOM Item",

View File

@ -8,7 +8,19 @@ from frappe.model.utils.rename_field import rename_field
def execute(): def execute():
for doctype in ['BOM Explosion Item', 'BOM Item', 'Work Order Item', 'Item']: for doctype in ['BOM Explosion Item', 'BOM Item', 'Work Order Item', 'Item']:
if frappe.db.has_column(doctype, 'allow_transfer_for_manufacture'): 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']: for doctype in ['BOM', 'Work Order']:
frappe.reload_doc('manufacturing', 'doctype', frappe.scrub(doctype)) frappe.reload_doc('manufacturing', 'doctype', frappe.scrub(doctype))