gpt4 book ai didi

xpath - 如何在 Odoo 中使用 xpath 替换第二个具有相同名称的按钮

转载 作者:行者123 更新时间:2023-12-03 16:04:18 25 4
gpt4 key购买 nike

销售订单中有两个同名按钮

 <button name="action_confirm" id="action_confirm"
string="Confirm" class="btn-primary" type="object"
attrs="{'invisible': [('state', 'not in', ['sent'])]}"/>
**<button name="action_confirm"
string="Confirm" type="object"
attrs="{'invisible': [('state', 'not in', ['draft'])]}"/>**

需要使用 xpath 选择第二个按钮并更改其属性

最佳答案

在这里试试这个:

        <!-- make priority bigger to make sure that this XPATH is used after the one
that adds the button -->
<field eval="100" name="priority"/>
<field name="arch" type="xml">
<xpath expr='//buttion[@name="action_confirm"][2]' position='replace'/>
</field>

关于xpath - 如何在 Odoo 中使用 xpath 替换第二个具有相同名称的按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57831456/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com