如何隐藏 odoo 13 销售点看板 droplist/drop 菜单?

how to hide odoo 13 point of sale kanban droplist/drop menu?

我试过这段代码但没有任何反应:

#view.xml

<odoo>
 <data>

  <record id="view_pos_config_kanban_inherit" model="ir.ui.view">
    <field name="name">pos.config.inherit</field>
    <field name="model">pos.config</field>
    <field name="inherit_id" ref="point_of_sale.view_pos_config_kanban"/>
    <field name="arch" type="xml">
     <xpath expr="//kanban/templates/t/div/div[3][contains(@class='o_kanban_manage_button_section')]" position="replace">
     </xpath>
    </field>
  </record>

 </data>
</odoo>

What I want To Hide

由于 div.

中使用了 contains 函数,Odoo 将引发 odoo.tools.convert.ParseError: "Invalid number of arguments"

可以查看Odoo提供的XPath文档,contains是一个操作字符串的函数:

contains(s1, s2)
    returns true if s1 contains s2

使用 XPath 定位 div o_kanban_manage_button_section class 并使其不可见。

示例:

<record id="view_pos_config_kanban" model="ir.ui.view">
    <field name="name">pos.config.kanban.view</field>
    <field name="model">pos.config</field>
    <field name="inherit_id" ref="point_of_sale.view_pos_config_kanban"/>
    <field name="arch" type="xml">
        <xpath expr="//t/div/div/div[@class='o_kanban_manage_button_section']" position="attributes">
            <attribute name="invisible">True</attribute>
        </xpath>
    </field>
</record>  

我的解决方案:

<odoo>
    <data>
        <record id="view_pos_config_kanban" model="ir.ui.view">
            <field name="name">pos.config.kanban.view</field>
            <field name="model">pos.config</field>
            <field name="inherit_id" ref="point_of_sale.view_pos_config_kanban"/>
            <field name="arch" type="xml">
                <xpath expr="//kanban/templates/t/div/div[1]/div[2][@class='o_kanban_manage_button_section']" position="replace">
                </xpath>
            </field>
        </record>
    </data>
</odoo>