- make barcode mandatory if child row is added
- check valid barcode only if exists
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index a6af44b..6836793 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -486,15 +486,16 @@
         from stdnum import ean
         if len(self.barcodes) > 0:
             for item_barcode in self.barcodes:
-                duplicate = frappe.db.sql("""select parent from `tabItem Barcode` where barcode = %s and parent != %s""", (item_barcode.barcode, self.name))
-                if duplicate:
-                    frappe.throw(_("Barcode {0} already used in Item {1}").format(
-                        item_barcode.barcode, duplicate[0][0]))
+                if item_barcode.barcode:
+                    duplicate = frappe.db.sql("""select parent from `tabItem Barcode` where barcode = %s and parent != %s""", (item_barcode.barcode, self.name))
+                    if duplicate:
+                        frappe.throw(_("Barcode {0} already used in Item {1}").format(
+                            item_barcode.barcode, duplicate[0][0]))
 
-                if item_barcode.barcode_type:
-                    if not ean.is_valid(item_barcode.barcode):
-                        frappe.throw(_("Barcode {0} is not a valid {1} code").format(
-                            item_barcode.barcode, item_barcode.barcode_type))
+                    if item_barcode.barcode_type:
+                        if not ean.is_valid(item_barcode.barcode):
+                            frappe.throw(_("Barcode {0} is not a valid {1} code").format(
+                                item_barcode.barcode, item_barcode.barcode_type))
 
     def validate_warehouse_for_reorder(self):
         '''Validate Reorder level table for duplicate and conditional mandatory'''
diff --git a/erpnext/stock/doctype/item_barcode/item_barcode.json b/erpnext/stock/doctype/item_barcode/item_barcode.json
index e592981..c8a3a89 100644
--- a/erpnext/stock/doctype/item_barcode/item_barcode.json
+++ b/erpnext/stock/doctype/item_barcode/item_barcode.json
@@ -38,7 +38,7 @@
    "read_only": 0, 
    "remember_last_selected_value": 0, 
    "report_hide": 0, 
-   "reqd": 0, 
+   "reqd": 1, 
    "search_index": 0, 
    "set_only_once": 0, 
    "unique": 1
@@ -85,7 +85,7 @@
  "issingle": 0, 
  "istable": 1, 
  "max_attachments": 0, 
- "modified": "2017-12-10 19:45:08.634821", 
+ "modified": "2017-12-10 20:55:23.814039", 
  "modified_by": "Administrator", 
  "module": "Stock", 
  "name": "Item Barcode",