diff --git a/erpnext/patches.txt b/erpnext/patches.txt index fe5ceda8ad..772ae55a78 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -479,3 +479,4 @@ erpnext.patches.v9_2.rename_net_weight_in_item_master erpnext.patches.v9_2.delete_process_payroll erpnext.patches.v10_0.add_agriculture_domain erpnext.patches.v10_0.add_non_profit_domain +erpnext.patches.v10_0item_barcode_childtable_migrate diff --git a/erpnext/patches/v10_0/item_barcode_childtable_migrate.py b/erpnext/patches/v10_0/item_barcode_childtable_migrate.py new file mode 100644 index 0000000000..d36012ddd1 --- /dev/null +++ b/erpnext/patches/v10_0/item_barcode_childtable_migrate.py @@ -0,0 +1,15 @@ +# Copyright (c) 2017, Frappe and Contributors +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals + +import frappe + + +def execute(): + items_barcode = frappe.db.sql("SELECT name, barcode FROM tabItem WHERE barcode IS NOT NULL", as_dict=1) + + for item in items_barcode: + doc = frappe.get_doc("Item", item.name) + doc.append("barcodes", {"barcode": item.get("barcode")}) + doc.save()