Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Artificial Intelligence
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Property Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

Use of QR Codes and Barcodes in PDF's

Subscribe

Get notified when there's activity on this post

This question has been flagged
pdfreportsqrcode
1 Reply
967 Views
Avatar
Ian Gennaro Guitron Sagaon (iggs)

Hello community, does anyone knows if Odoo has a way to use QR codes in PDF documents? I need to use generate some information in my QR code related to data in the PDF.

0
Avatar
Discard
Avatar
Ian Gennaro Guitron Sagaon (iggs)
Author Best Answer

Odoo allows the creation of a QR-type image that is fed with information from the database (dynamic fields), similar to how we fill a PDF document with various dynamic fields. To achieve this, we will use the Studio application and the PDF editor (specifically the “QWeb”). Follow these steps:

  • Access the PDF report you want to edit using Studio (for this example, we will use a new document).





  • Once the new document or the document to edit is ready, use the "</> Edit Sources" function.



  • Now we will insert code to create the QR image we need:

  • 💡

    Remember that when inserting elements, we must follow best practices by using the web.studio view and the corresponding xpath.


  • <img t-att-src="'/report/barcode/QR/%s' % (doc.partner_id.name)"/>

This code is represented as follows:

  • With the code written, you will be able to see the QR code information, but not in the desired format. To fix this, use the following extension:
  • <img t-att-src="'/report/barcode/QR/%s' % (doc.partner_id.name)" style="width:120px;height:120px"/>

  • The result of the code is the next one:


  • If you need to include more information, you must use connectors within the parentheses of the code.

    • Use the connector "+" to add more fields.
    • You can keep adding as many fields as needed.
✅

PRO TIP:

Remember to keep simple the information, when using more than 200 characters the QR becomes difficult to be read. If you need to use more than this amount of characters, we recommend to use a link to access the information from the QR.



  • When scanned, the result will be:



  • If you want the information to appear separated, you can include separators within the code to improve readability.


  • Quotation marks allow you to define spaces, separators, or text characters. The result will look like this:



  • ⚠️
    If an error appears when saving the information: 
    Add spaces between elements inside single quotes 
    Example: ' / ', ' Folio ', etc.
  • Once all elements and fields have been configured, you can finish editing the document, and it will update according to the information entered in the system.
❌
It is very important that when implementing these configurations, we remind that there are laws and regulations protecting personal data, which is considered restricted.

Some examples of this are: SSN, RFC, internal ID's, personal emails, bank accounts and more. 

For more information, visit: Personal and Sensitive Information

BARCODES

For barcodes, the process is similar. However, keep in mind:

  • Barcodes can only store a single alphanumeric value (as in the Inventory application).
💡
There are several types of barcodes, the common ones are the next ones:
  • CODE128 (most common in Odoo) [USE THIS FOR DOCUMENTS]

    • Flexible (Complete ASCII)
    • 20 - 30 characters (optimal length)
  • EAN13

    • 13 characters
    • For retail products
  • CODE39

    • A-Z, 0-9, and some symbols
    • If is more 

To insert a barcode into a PDF document, follow the same steps but use the following code:

<div t-field="doc.name" t-options="{'widget': 'barcode', 'width': 400, 'height': 100}"/>

It is a text field rendered visually as a barcode using a widget.

💡
It could also be done as: 

<img t-att-src="'/report/barcode/Code128/%s' % doc.name"/>

The final result will look like this:

GENERAL RECOMMENDATIONS

Next, here are some recommendations to take in consideration about using this tipe of functions in Odoo:

  • The recommended minimal size to use is:

    • QR: 2x2 cm [Ideal= 3 - 4cm]
    • Barcode: height = 1 cm [quiet zone is mandatory]
  • When positioning the QR or Barcode is important to avoid borders of the document and fold areas (if printed).
  • Try to keep a good contrast to help the lecture of the code (white background and solid black text).
⚠️
REMEMBER TO TEST THE CODE: Print it, scan it with several devices and test different sizes to confirm that the information works.

More information

0
Avatar
Discard
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Related Posts Replies Views Activity
PDF report name isn't respected when using module from app store
pdf reports
Avatar
0
Sep 21
4760
PDF reports show negative amounts with vertical bar "|" instead of "-". How can I fix this.?
pdf reports
Avatar
Avatar
1
May 18
5775
No css format on PDF reports after upgrade Odoo Server 10.0-20170119 ! (no headers) Solved
pdf reports
Avatar
Avatar
2
Jan 17
8714
Reports not auto-saved to attachments Solved
pdf reports
Avatar
Avatar
Avatar
3
Mar 15
9627
Add Customer Name to Printed Reports Name Solved
pdf reports 17.2
Avatar
Avatar
Avatar
2
Oct 24
4278
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk Slovenščina Español (América Latina) Español Svenska ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now