简体   繁体   English

如何在 Odoo 中实现第三方 JS 库

[英]how to implement third party JS library in Odoo

Hi I want to implement this qr code generator in odoo pos but i don't have any idea how to do it and I can't see any tutorial even in Javascript reference in odoo 12嗨,我想在 odoo pos 中实现这个二维码生成器,但我不知道怎么做,即使在odoo 12 中的 Javascript 参考中我也看不到任何教程

I want to generate a qr code with the receipt reference(this.uid) as output(when scanned) and display it in PosTicket我想生成一个带有收据参考(this.uid)的二维码作为输出(扫描时)并将其显示在 PosTicket

i've tried adding the qrcode.min.js and qrcode.js in my static/src/js folder and adding我尝试在我的 static/src/js 文件夹中添加 qrcode.min.js 和 qrcode.js 并添加

<script src="/tw_pos_inherit/static/src/js/qrcode.min.js" type="text/javascript"></script>
<script src="/tw_pos_inherit/static/src/js/qrcode.js" type="text/javascript"></script>

to my view and tried the said example but it always give me an error在我看来并尝试了上述示例,但它总是给我一个错误

anyone who have an idea how to use third party javascript library in odoo12 please show me an example任何知道如何在odoo12中使用第三方javascript库的人请给我一个例子

thank you谢谢你

OK so I just need to move the js and min.js file in my static/src/js folder and add the code好的,所以我只需要在我的 static/src/js 文件夹中移动 js 和 min.js 文件并添加代码

<script src="/tw_pos_inherit/static/src/js/qrcode.js" type="text/javascript"></script>
<script src="/tw_pos_inherit/static/src/js/qrcode.min.js" type="text/javascript"></script>

to my assets file and到我的资产文件和

and i tried the examples again like我再次尝试了这些例子

this.qrcode = new QRCode('qrcode');
this.qrcode.makeCode(this.pos.get_order().uid);

to my initialized function and it worked properly到我initialized的 function 并且它工作正常

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM