Update search view: dynamic field-based filters only, no hardcoded values
Some checks failed
pre-commit / pre-commit (push) Has been cancelled
tests / Detect unreleased dependencies (push) Has been cancelled
tests / test with OCB (push) Has been cancelled
tests / test with Odoo (push) Has been cancelled

This commit is contained in:
2026-03-14 00:31:28 +00:00
parent 7351c558ce
commit b57b2e75ab

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- List View — mirrors extension columns -->
<!-- List View -->
<record id="wt_location_log_view_list" model="ir.ui.view">
<field name="name">wt.location.log.list</field>
<field name="model">wt.location.log</field>
@@ -66,20 +66,21 @@
</field>
</record>
<!-- Search View -->
<!-- Search View — dynamic field-based only, no hardcoded values -->
<record id="wt_location_log_view_search" model="ir.ui.view">
<field name="name">wt.location.log.search</field>
<field name="model">wt.location.log</field>
<field name="arch" type="xml">
<search string="Search Location Logs">
<field name="name"/>
<field name="address"/>
<field name="place_name"/>
<field name="category"/>
<field name="date"/>
<filter string="Today" name="today" domain="[('date','=', context_today().strftime('%Y-%m-%d'))]"/>
<filter string="This Week" name="this_week" domain="[('date','&gt;=', (context_today() - datetime.timedelta(days=7)).strftime('%Y-%m-%d'))]"/>
<group expand="0" string="Group By">
<!-- Search by any of these fields — autocompletes from existing data -->
<field name="name" string="Name"/>
<field name="address" string="Address"/>
<field name="place_name" string="Place Name"/>
<field name="category" string="Category"/>
<field name="date" string="Date"/>
<field name="travel_mode" string="Travel Mode"/>
<!-- Group By — dynamic, shows whatever values exist in data -->
<group expand="1" string="Group By">
<filter string="Date" name="group_date" context="{'group_by': 'date'}"/>
<filter string="Category" name="group_category" context="{'group_by': 'category'}"/>
<filter string="Travel Mode" name="group_travel_mode" context="{'group_by': 'travel_mode'}"/>