【问题标题】:Integrate SVGs in Odoo在 Odoo 中集成 SVG
【发布时间】:2022-03-20 01:15:23
【问题描述】:

我正在尝试将 SVG 集成到我使用 builder-module 构建的 odoo 网站中。可以集成简单的内联 svg,例如:

<svg width="100" height="100">
  <circle cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="yellow" />
</svg> 

但是,如果我尝试集成 inkscape 生成的 SVG,odoo 不会保存它们或者只是崩溃。

对此有何想法或建议?

【问题讨论】:

  • 简化 inkscape 图像,直到找出导致崩溃的原因,然后将其与测试用例一起报告给 Odoo。
  • 感谢您的意见,罗伯特,现在可以工作了!对于新手来说,需要注意的是,inkscape 有自己的 .svg 文件,它在源代码中添加了各种东西。不知何故,odoo 不喜欢那样。

标签: html xml svg openerp


【解决方案1】:

您可以将您的 svg 写入自己的文件:your_svg_file.svg 并以这种方式将其加载到名为“your_module”的自定义模块的 your_module/templates/template.xml 中:


<template id="custom_accordion" name="Custom Accordion">
    <section class="container gp_accordions" >
        <div class="row colfixed mb-5">
           <div class="col-lg-12 s_title">
              <h2 class="landing">Frequently Asked Questions</h2>
                    ...
                    ...
               <div class="ac_icon">
                 <div class="ac_lns">
 <img src="/your_module/static/src/img/snippets/structure/your_svg_file.svg"/>
                   </div>

【讨论】:

    【解决方案2】:

    到目前为止,odoo 不支持 svg 加载到 qweb 模板中

    【讨论】:

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