【问题标题】:how to implement third party JS library in Odoo如何在 Odoo 中实现第三方 JS 库
【发布时间】:2020-06-01 04:44:15
【问题描述】:

嗨,我想在 odoo pos 中实现这个 qr code generator 但我不知道该怎么做,即使在Javascript reference in odoo 12 中我也看不到任何教程@

我想生成一个带有收据参考(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 库的人请给我一个示例

谢谢

【问题讨论】:

  • 如果您有任何解决方案,请在此处更新。

标签: javascript odoo qr-code odoo-12


【解决方案1】:

好的,我只需将 js 和 min.js 文件移动到我的 static/src/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 函数,它工作正常

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多