Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How to add barcode(EAN 13) option in my custom module.In my module I have a list of members and I want to assign a unique barcode for each member.I am new to odoo.Help or guideline is much appricated.

By
Tauseef
on 12/6/15, 1:02 AM 434 views

I used this in python file file  in onchange of a field  for code 39(another type of barcode)


from reportlab.pdfgen import canvas

from reportlab.lib.pagesizes import A4

from reportlab.lib.units import mm

#I"ll be generating code39 barcodes, others are available

from reportlab.graphics.barcode import code39

# generate a canvas (A4 in this case, size doesn"t really matter)

c=canvas.Canvas("/tmp/barcode_example.pdf",pagesize=A4)

# create a barcode object

# (is not displayed yet)

# The encode text is "123456789"

# barHeight encodes how high the bars will be

# barWidth encodes how wide the "narrowest" barcode unit is

barcode=code39.Extended39("123456789",barWidth=0.5*mm,barHeight=20*mm)

# drawOn puts the barcode on the canvas at the specified coordinates

barcode.drawOn(c,100*mm,100*mm)

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 12/6/15, 1:02 AM
Seen: 434 times
Last updated: 12/6/15, 4:25 AM