You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Odoo 10 Fleet模块自定义筛选器及字段增删编辑方法咨询

Odoo 10 Fleet模块自定义筛选器操作指南

Hey there, let's break down how to handle custom filters in Odoo 10's Fleet module step by step:


1. 删除自定义筛选器时显示的部分字段

If you want to hide certain fields from appearing in the custom filter dropdown, you'll need to modify the search view of the relevant Fleet model (like fleet.vehicle for vehicles). Here's how:

  • First, identify the original search view for the model you're working with. For Fleet vehicles, the default view ID is fleet_vehicle_view_search.

  • Create a custom module (or use an existing one) that depends on the fleet module (add 'fleet' to the depends list in your __manifest__.py).

  • In your module's XML file, inherit the search view and mark the unwanted fields as invisible, or remove them entirely:

    <record id="custom_fleet_vehicle_search_view" model="ir.ui.view">
        <field name="name">fleet.vehicle.search.custom</field>
        <field name="model">fleet.vehicle</field>
        <field name="inherit_id" ref="fleet.fleet_vehicle_view_search"/>
        <field name="arch" type="xml">
            <!-- Hide the "Brand" field from search/filter options -->
            <field name="brand_id" position="attributes">
                <attribute name="invisible">1</attribute>
            </field>
            <!-- Or remove the field completely -->
            <!-- <field name="model_id" position="replace"/> -->
        </field>
    </record>
    
  • Install/update your custom module, and the hidden fields will no longer show up when creating custom filters.


2. 添加/删除现有自定义筛选器

Adding a custom filter

  • Navigate to the Fleet model's list view (e.g., Fleet > Vehicles).
  • Click the Filters dropdown, then select Add Custom Filter.
  • Fill in the details: choose a field, set a condition (like "is equal to"), input a value, and give your filter a name.
  • Hit Save—your new filter will now appear in the Filters dropdown.

Deleting a custom filter

  • Open the Filters dropdown and find the custom filter you want to remove.
  • Hover over it, and you'll see a small X icon (or click the pencil icon to edit, then select Delete).
  • Confirm the deletion, and the filter will be removed from the list.

Note: You can't delete Odoo's default system filters directly via the UI—you'd need to modify the search view XML (like in section 1) to remove those.


3. 编辑自定义筛选器选项内的筛选器与字段

Editing an existing custom filter

  • Go to the Filters dropdown, find the filter you want to edit, and click the pencil icon next to it.
  • Modify the field, condition, or value as needed, and update the filter name if you want.
  • Click Save to apply your changes.

Adding fields to the custom filter options

If you want a new field to show up in the custom filter dropdown (so you can filter by it), you need to add it to the search view:

  • In your custom module's XML, inherit the search view and add the field:
    <record id="custom_fleet_vehicle_search_view" model="ir.ui.view">
        <field name="name">fleet.vehicle.search.custom</field>
        <field name="model">fleet.vehicle</field>
        <field name="inherit_id" ref="fleet.fleet_vehicle_view_search"/>
        <field name="arch" type="xml">
            <!-- Add a custom field to search/filter options -->
            <field name="vin_sn" position="after">
                <field name="your_custom_field"/>
            </field>
        </field>
    </record>
    
  • After updating your module, the new field will be available when creating/editing custom filters.

内容的提问来源于stack exchange,提问作者mahmoud alaa

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 08:30:41