[Hot Fix] barcode_type auto set to a wrong value (#12957)
* Fix barcode_type auto set to a wrong value
This fix a problem that arise, for some weird reason that i can't figure out, when the barcode length == 8, 9,10 or 12,13 and barcode_type is not set; barcode_type become "ean8, ean9, ean10, ean11, ean12, ean13"
* codacy fix
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index 9758b93..4b97fa3 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -490,6 +490,7 @@
frappe.throw(_("Barcode {0} already used in Item {1}").format(
item_barcode.barcode, duplicate[0][0]))
+ item_barcode.barcode_type = "" if item_barcode.barcode_type not in ["EAN", "UPC-A"] else 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(