From 3a2f342ac180f53456b2def5bb809cd00047ef6d Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Sat, 16 Feb 2019 21:09:24 +0530 Subject: [PATCH] Ignore duplicate entry --- .../v10_0/item_barcode_childtable_migrate.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/erpnext/patches/v10_0/item_barcode_childtable_migrate.py b/erpnext/patches/v10_0/item_barcode_childtable_migrate.py index c939dd5d33..a2e25795eb 100644 --- a/erpnext/patches/v10_0/item_barcode_childtable_migrate.py +++ b/erpnext/patches/v10_0/item_barcode_childtable_migrate.py @@ -16,11 +16,14 @@ def execute(): barcode = item.barcode.strip() if barcode and '<' not in barcode: - frappe.get_doc({ - 'idx': 0, - 'doctype': 'Item Barcode', - 'barcode': barcode, - 'parenttype': 'Item', - 'parent': item.name, - 'parentfield': 'barcodes' - }).insert() + try: + frappe.get_doc({ + 'idx': 0, + 'doctype': 'Item Barcode', + 'barcode': barcode, + 'parenttype': 'Item', + 'parent': item.name, + 'parentfield': 'barcodes' + }).insert() + except frappe.DuplicateEntryError: + continue