ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Printing barcode tag for apparels using ERPNext


#1

I am getting started with creation of e-commerce presence for a non profit social enterprise which is into manufacturing apparels like Shirts, Jeans etc. Before I buy ERPNext subscription I would like to clear few doubts about barcodes in ERPNext.

  1. The manufacturer has valid UPC/EAN barcodes purchased from authorised sources.
  2. Now they want to create barcode label which can be pasted on apparel tags. I am attaching the print format we are looking for.

    The above photo is taken at Trent Westside. We need exactly same print design with manufacturer, marketed by, style, SKU etc details printed. As of now we have just the barcode numbers.

Can we create and print above mentioned label in ERPNext using custom print formats?. If yes, how to do it?, Can someone please tell me?. If not what other free and open source software can do it?.

Please excuse me if this question sounds silly. I am new to this whole barcode thing.

Regards
Harold Osprey


#2

Hello @HaroldOsprey,
1.Use pyBarcode Library.
2.API URL:http://localhost:8000/api/method/erun_util.util.erun_barcode.barcode_gen?b_type=Code39&b_string=pizza-1024531-product
3.Use the following code and call this API in your print format.

@frappe.whitelist(allow_guest=True)
def barcode_gen(b_type,b_string):
    from barcode.writer import ImageWriter
    ean = barcode.get(b_type, b_string, writer=ImageWriter())
    filename = ean.save(b_string)
    filedata = ""
    with open(filename, "rb") as fileobj:
        filedata = fileobj.read()
    frappe.local.response.filename = filename
    frappe.local.response.filecontent = filedata
    frappe.local.response.type = "download"
    cleanup(filename)
    return ean

def cleanup(fname):
    if os.path.exists(fname):
        os.remove(fname)

this api can be called from any print-format
for e.g:<img src=“http://localhost:8000/api/method/erun_util.util.erun_barcode.barcode_gen?b_type=Code39&b_string={{frappe.db.get_value(“Item”, item.item_code, ‘barcode’)}}-{{item.batch_no}}-{{frappe.db.get_value(‘Item’, item.item_code, ‘barcode’)}}-{{item.batch_no}}”>

we are also looking at the best way to contribute this API in frappe/erpnext core.

Thanks,
Sagar Shiragawakar


#3

Thanks for the heads-up. I plan to go with SaaS version, don’t have developers capable of handling ERPNext with me. Hope Frappe can make this custom barcode print format and include it in the core.


#4

I hope for the same.