snv
May 14, 2023, 5:36am
2
Hello,
Barcodes are something that are hard to standardize. There are different printers, which print barcodes of different dimensions, with different gaps between each barcode, different margins required etc.
One option is to use the field of type Barcode .
Another option is to use a print format. I had implemented a print format for my use-case back in Oct. 2016, maybe it will help:
Update: this is now a functioning example with issue fixed
Auto generating barcode:
import random
def validate_barcode(self):
if self.barcode:
if self.barcode == "auto":
existing = frappe.db.sql_list("select barcode from tabItem")
self.barcode = random.choice([item for item in map(str, range(1000,10000)) if item not in existing])
..
Customize Form Item:
[image]
New Print Format HTML:
<table class="custom">
<tr>
<td class="papa">
<p class="text-center" style="font-weight:…
You can also consider contributing a barcode print generator to Frappe/ERPNext , it’s open source
1 Like