Handy Tip for Odoo Developers and Testers

Simulate a Barcode Scan Without a Physical Scanner!

Muhammad Abdullah Arif
2 min readAug 28, 2024
Photo by Christina @ wocintechchat.com on Unsplash

Working on Odoo’s Barcode application to manage logistics but don’t have a barcode scanner readily available for testing or development? No worries, I’ve got a quick trick for you!

🔧 How to Do It:

  • Right-click on your screen.
  • Select “Inspect” to open the developer tools.
  • Go to the “Console” tab.
  • Enter the following command:
odoo.__DEBUG__.services["web.core"].bus.trigger("barcode_scanned", "yourbarcodehere", $(".o_web_client")[0])
  • Replace "yourbarcodehere" with the barcode you want to simulate.

And there you go! You’ve just simulated a barcode scan without needing a physical scanner. 🎉

📌 Quick Reminder

Testing your features by manually altering data doesn’t always mimic the exact behaviour of an actual scan. This trick is essential to ensure everything works seamlessly!

--

--

Muhammad Abdullah Arif

Python developer. The facts are the facts but opinions are my own.