I have modified item.py
by adding following lines to validate_barcode
function:
if self.barcode == "auto":
existing = frappe.db.sql("""select barcode from tabItem""", as_list=True)
self.barcode = random.choice([item for item in range(1000,10000) if item not in existing])
However, barcode remains as ‘auto’ instead of getting updated. What am I doing wrong?
Here’s the modified file for reference: item.py · GitHub