How to print barcode label

Hi

I need print item barcode on the label format like

image

4 Likes

Use Barcode type field and a custom print format

2 Likes

could you eleborate

3 Likes

Did you get it @farhanayyaz1

1 Like

nothing

1 Like

@farhanayyaz1 :frowning:

1 Like

dear anyone has an update on this.c

1 Like

Any one?
I am trying to achieve the same.
Can anyone guide on custom script?

Current Plan is to pull item details on a printable area.( printable area can be the size of the label)
Using the Purchase receipt/ material receipt item data.

I would like to know how to loop the print format area for each item row?

1 Like

Finally we made a custom JS Barcode script and a custom Print format for 1.5 X 1 Inch barcode labels.

Used it in Stock entry(material receipt) and Purchase Receipt. With batch number and expiry.
Also made a print checkbox in item row. If ticked then it will only print the item row checked to print.

Sample below:

image

Above image has the following:
Font used Sans serif with 10, and 8 size
Company Name.
Item Name
Item Code
Batch Number in Barcode Font.
Expiry Date and Price.

Everything can be customized thanks to frappe framework.

5 Likes

Hello @fkardame @JoEz

How to set the value of the barcode field type from javascript and python?

Regards
Bilal

1 Like

What u mean by type? Like code128A or upc?
I didnt get ur question

1 Like

Thank you @fkardame
I mean how to set the value of the barcode field?
In other words: if the field type is barcode (I mean by type is the type of the field which might be Int, Float, Text, Table, HTML, barcode, … etc), so how to set the value of this barcode field.

I need to set the value from javascript or from python, and not from user interface. I know that I can enter it directly from the keyboard, but I need to set the value from js or py.
Regards
Bilal

1 Like

Hello @fkardame
As example:

frm.set_value('discount_amount', 100);

Is used to set the value of the field name discount_amount to 0, but if we use the same code to set the value of the barcode field then it will not work. So how can we set the value of the barcode field using javascript and python?

I need to set the value of the barcode to be 1122334455, how?

Regards
Bilal

1 Like

Any help?

1 Like

Hello @JoEz
Can you please help in this if possible?
Because you suggested to use barcode field type, so I expect that you have experience in this (if you can help please).
If not possible, I hope to advise me that it is not possible and then we can find another way.
But normally, it should be possible to set the value of any field !
Regards
Bilal

Try using Value field as {{ doc.barcode }} and field type as Data

<svg class="barcode"
			jsbarcode-margin="0"
			jsbarcode-margintop="0"
			jsbarcode-marginbottom="1"
			jsbarcode-height="25"
			jsbarcode-width="1"
			jsbarcode-fontsize="12"
			jsbarcode-flat="true"
			jsbarcode-value="{{ doc.barcode}}"/></svg></br> <script src="https://cdn.jsdelivr.net/npm/jsbarcode@3.9.0/dist/JsBarcode.all.min.js"></script>

This is the script we use in print format for barcode

4 Likes

Thank you @fkardame

<script src="https://cdn.jsdelivr.net/npm/jsbarcode@3.9.0/dist/JsBarcode.all.min.js"></script>

Can you please help, if I need to download JsBarcode.all.min.js and place it locally, for example if I placed it under the custom application of the following path:
home/frappe/frappe/apps/collection/collection/public/js/JsBarcode.all.min.js so how it will be the link to be used for src?

Anyway, this is for printing and thank you @fkardame

But have you tried to use the barcode field type which is existed in erpnext?
I hope that @JoEz or @pratu16x7 can help in advising how to set the value field of the barcode field because they are the owner andn contributor for this field type from this topic:

Regards
Bilal

1 Like

Have a look at:

1 Like

Hello @JoEz
What you mentioned is about the options and not about the value.
I am asking how to set the value of the barcode from javascript and not the options.

In other words:
If I have a data field that has the following value: “11223344” and I need to set the value of the barcode field to this data field from javascript, what is the js code to be used?

Is it frm.set_value('barcode_field_name', data_field_name); ?
I tried set_value and it did not work.

Please advice.
Regards
Bilal

1 Like

Could you please share your script, or info on how to add additional button and wire up script to it.

1 Like