簡體   English   中英

如何在 Odoo 中實現第三方 JS 庫

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

嗨,我想在 odoo pos 中實現這個二維碼生成器,但我不知道怎么做,即使在odoo 12 中的 Javascript 參考中我也看不到任何教程

我想生成一個帶有收據參考(this.uid)的二維碼作為輸出(掃描時)並將其顯示在 PosTicket

我嘗試在我的 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>

在我看來並嘗試了上述示例,但它總是給我一個錯誤

任何知道如何在odoo12中使用第三方javascript庫的人請給我一個例子

謝謝你

好的,所以我只需要在我的 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>

到我的資產文件和

我再次嘗試了這些例子

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

到我initialized的 function 並且它工作正常

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM