patch to migrade barcodes into Item Barcode

This commit is contained in:
Giovanni 2017-12-11 09:54:18 +01:00
parent 43372d3333
commit dd37ceb707
2 changed files with 16 additions and 0 deletions

View File

@ -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

View File

@ -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()