如何在 Odoo 中使用 xpath 替换第二个具有相同名称的按钮
How can I replace the second button with same name using xpath in Odoo
销售订单表单中有两个同名按钮
<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'])]}"/>**
需要 select 第二个按钮使用 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>
销售订单表单中有两个同名按钮
<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'])]}"/>**
需要 select 第二个按钮使用 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>