From e6236094a643fce575d6d52f4ca83c0f6444979f Mon Sep 17 00:00:00 2001 From: Karthikeyan S Date: Fri, 28 Jun 2019 12:46:42 +0530 Subject: [PATCH] fix(item): fix patch for barcode childtable migration in item (#18069) * fix(item): fix patch for barcode childtable migration in item (cherry picked from commit b2c43ee2d91599038f7bdf2038bbc4c4e7b36285) * fix(item): fixing broken patch item_barcode_childtable_migrate (cherry picked from commit beca677276e0b5b143cd6d1d08efa8529663f60c) --- erpnext/patches.txt | 2 +- erpnext/patches/v10_0/item_barcode_childtable_migrate.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/patches.txt b/erpnext/patches.txt index dcf91a4a69..fa51638605 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -594,7 +594,7 @@ erpnext.patches.v11_1.make_job_card_time_logs erpnext.patches.v12_0.rename_pricing_rule_child_doctypes erpnext.patches.v12_0.move_target_distribution_from_parent_to_child erpnext.patches.v12_0.stock_entry_enhancements -erpnext.patches.v10_0.item_barcode_childtable_migrate # 16-02-2019 +erpnext.patches.v10_0.item_barcode_childtable_migrate # 16-02-2019 #25-06-2019 erpnext.patches.v12_0.move_item_tax_to_item_tax_template erpnext.patches.v11_1.set_variant_based_on erpnext.patches.v11_1.woocommerce_set_creation_user diff --git a/erpnext/patches/v10_0/item_barcode_childtable_migrate.py b/erpnext/patches/v10_0/item_barcode_childtable_migrate.py index e30e0a74c0..ec9c6c3b76 100644 --- a/erpnext/patches/v10_0/item_barcode_childtable_migrate.py +++ b/erpnext/patches/v10_0/item_barcode_childtable_migrate.py @@ -8,8 +8,10 @@ import frappe def execute(): frappe.reload_doc("stock", "doctype", "item_barcode") + if frappe.get_all("Item Barcode", limit=1): return + if "barcode" not in frappe.db.get_table_columns("Item"): return - items_barcode = frappe.get_all('Item', ['name', 'barcode'], { 'barcode': ('!=', '') }) + items_barcode = frappe.db.sql("select name, barcode from tabItem where barcode is not null", as_dict=True) frappe.reload_doc("stock", "doctype", "item")