【问题标题】:Add external javascript library to odoo 12将外部 javascript 库添加到 odoo 12
【发布时间】:2020-10-04 02:13:30
【问题描述】:

您好,我是 odoo 新手,我使用的是 12 版,我想添加一个外部 javascript 库,它是 loading.io https://loading.io/progress/

我不知道如何添加它,因为我看到无法使用 cdn。

任何帮助或提示将不胜感激,并提前致谢。

【问题讨论】:

  • Installation: download loading bar JS and CSS files ( or, the zipped pack ) and include them in your HTML - loading.io/progress/#installation - 即将它们托管在您的服务器上

标签: javascript python odoo odoo-12 erp


【解决方案1】:

向 Odoo 添加 Javascript 或 CSS 资产,扩展适当的资产模板。

这可能是:

  • web.assets_frontend 用于前端网页。
  • web.assets_backend 用于后端 Web 客户端页面。
  • web.assets_common 用于后端和前端。

资产文件(如果捆绑的话)应该在您的模块中,在 static/lib/cssstatic/lib/js 子目录中。

例如:

<odoo>
  <template id="mymodule_web_assets" name="My Web Assets"
            inherit_id="web.assets_frontend">
     <xpath expr="." position="inside">

       <link rel="stylesheet" type="text/css"
             href="/<mymodule>/static/lib/css/loading-bar.css"/>
       <script type="text/javascript"
               src="/<mymodule>/static/lib/js/loading-bar.js"></script>

    </xpath>
  </template>
</odoo>

【讨论】:

    猜你喜欢
    • 2019-03-27
    • 1970-01-01
    • 2022-11-12
    • 2014-08-25
    • 1970-01-01
    • 1970-01-01
    • 2022-12-21
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多