Barcode image not visible in list view when assets are uploaded in bulk

I’m having trouble with barcode generation in ERPNext version 15 (self-hosted). When I upload assets in bulk using data import, the barcode image doesn’t appear in the list view. However, if I add assets one at a time or edit an existing asset (even with just cancel and amend), the barcode image is generated and displayed correctly in the list view. This prevents me from getting barcodes on printouts for bulk-uploaded assets.

I’ve attached an image here for reference.

1 Like

Yeah, the js needs to be called (via any modifications to the form like saving) in order to convert the alphanumeric value to svg.

The only workaround I used was to create the svg through a python library on saving of the document and store it in another field, which you can then print.

Right now, I’m using the default Asset doctype. So, do I need to create a custom one because the default will not allow me to make any changes to the existing doctype?

No, you can use the default Asset DocType, you just need to create a “before_save” doc event hook to a method in a .py file, which generates and saves the svg data to a custom field in the same Asset DocType.

1 Like