更改 OpenERP 中现有的过滤器字符串

change existing filter string in OpenERP

我正在尝试为状态添加自定义过滤器,基本上我只需要编辑现有过滤器的字符串。所以我做了这个 XML 部分,但我不太明白我在这里做错了什么:

        <record id="sale_order_list_select" model="ir.ui.view">
        <field name="name">sale.order.list.select</field>
        <field name="model">sale.order</field>
        <field name="inherit_id" ref="base.view_sales_order_filter"/>
        <field name="arch" type="xml">
            <search position="inside">
                <filter icon="terp-dolar_ok!" string="WON" domain="[('state','=','manual')]"
                        help="Sales Order ready to be invoiced"/>
            </search>
        </field>
    </record>

新示例:

     <record id="sale_order_list_select" model="ir.ui.view">
        <field name="name">sale.order.list.select</field>
        <field name="model">sale.order</field>
        <field name="inherit_id" ref="sale.view_sales_order_filter"/>
        <field name="arch" type="xml">
            <filter string="To Invoice" position="attributes">
                <attribute name="string">WON</attribute>
            </filter>
            <filter string="Done" position="attributes">
                <attribute name="string">LOST</attribute>
                <attribute name="domain">[('state','=','cancel' )]</attribute>
            </filter>
            <filter string="Sales" position="attributes">
                <attribute name="string">HOLD</attribute>
            </filter>
        </field>
    </record>

如果您只想更改现有过滤器的字符串而不是使用 attributes 例如:

<record id="sale_order_list_select" model="ir.ui.view">
    <field name="name">sale.order.list.select</field>
    <field name="model">sale.order</field>
    <field name="inherit_id" ref="sale.view_sales_order_filter"/>
    <field name="arch" type="xml">
        <filter string="To Invoice" position="attributes">
            <attribute name = "string">WON</attribute>
        </filter>
        <!-- After "Sales" filter it will add new "Cancel" filter -->
        <filter string="Sales" position="after">
            <filter icon="terp-dolar_ok!" string="Cancel" domain="[('state','=','cancel')]" help="Sales Order which are canceled"/>
        </filter>
    </field>
</record>