【问题标题】:"Element '<xpath expr="//head">' cannot be located in parent view” in odor 14气味 14 中的“元素 '<xpath expr="//head">' 无法位于父视图中”
【发布时间】:2021-05-26 20:07:48
【问题描述】:

我正在为电子商务开发一个自定义模块。 为此,我正在商店页面中创建一个组件。在这里,我需要自定义 css,并在此模板中编写以下代码

<template id="products_categories" inherit_id="website_sale.products" active="False" customize_show="True" name="Shop">
<xpath expr=“//head" position="inside">
    <link href="/extended__ecommerce/static/src/css/module.css" rel="stylesheet" />
</xpath>

然后重新运行和升级模块将触发异常,我发现问题标题中出现内部服务器错误。 我无法通过评论恢复到以前的版本

<!--            <xpath expr="." position="inside">-->
<!--                <link href="/extended__ecommerce/static/src/css/module.css" rel="stylesheet" />-->
<!--            </xpath>—>

那些代码行。

**我已将我的数据库更改为新数据库,但没有任何更改。

我怎样才能回到我之前运行的版本?

【问题讨论】:

    标签: python odoo odoo-14


    【解决方案1】:

    您的 XML 中似乎有一个无效字符。 &lt;xpath expr=" 中的双引号不是真正的双引号。请注意您的代码在代码宏中的突出显示效果不佳。我这里改了,你看看有什么不同吗?

    <template id="products_categories" inherit_id="website_sale.products" active="False" customize_show="True" name="Shop">
    <xpath expr="//head" position="inside">
        <link href="/extended__ecommerce/static/src/css/module.css" rel="stylesheet" />
    </xpath>
    

    请注意//head 是如何在此处正确突出显示的,但在您的帖子中却没有。

    【讨论】:

    • 我更改了代码。仍然,错误发生了。现在的重点是如何恢复到以前的版本?
    • 错误是 Error to render compile AST TypeError: _get_asset_nodes() got an unexpected keyword argument 'src' 模板:web.layout 路径:/t/html/head/t[7] 节点:
    【解决方案2】:
    <template id="products_categories" 
    inherit_id="website_sale.products" active="False" 
    customize_show="True" name="Shop">
    <xpath expr=". " position="inside">
    <link 
     href="/extended__ecommerce/static/src/css/module.css" 
    rel="stylesheet" />
    </xpath>
    

    【讨论】:

      猜你喜欢
      • 2021-07-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-01
      • 2012-09-02
      相关资源
      最近更新 更多