Files
Odoo-18.0-20251222/work_trace/views/wt_location_log_views.xml
tocmo0nlord 2406fc9aa8
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
feat: add travel mode and category quick-filter buttons to search view
2026-03-14 05:28:14 +00:00

134 lines
6.6 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Server Action: Geocode Next 20 (appears in list view Action dropdown) -->
<record id="action_geocode_next_batch" model="ir.actions.server">
<field name="name">Geocode Next 20 Addresses</field>
<field name="model_id" ref="model_wt_location_log"/>
<field name="binding_model_id" ref="model_wt_location_log"/>
<field name="binding_view_types">list,form</field>
<field name="state">code</field>
<field name="code">action = records.env['wt.location.log'].action_geocode_all_pending()</field>
</record>
<!-- Server Action: Compute Distances (appears in list view Action dropdown) -->
<record id="action_compute_distances_batch" model="ir.actions.server">
<field name="name">Recompute Distances</field>
<field name="model_id" ref="model_wt_location_log"/>
<field name="binding_model_id" ref="model_wt_location_log"/>
<field name="binding_view_types">list,form</field>
<field name="state">code</field>
<field name="code">records.action_compute_distances()</field>
</record>
<!-- 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>
<field name="arch" type="xml">
<list string="Location Logs" default_order="arrived_at asc">
<field name="category"/>
<field name="distance_from_previous" string="Distance (mi)"/>
<field name="address"/>
<field name="name" string="Name"/>
<field name="arrived_at" string="Begin Time"/>
<field name="departed_at" string="End Time"/>
<field name="time_at_location" string="Duration (hrs)" widget="float_time"/>
<field name="travel_mode" optional="show"/>
<field name="date" optional="show"/>
</list>
</field>
</record>
<!-- Form View -->
<record id="wt_location_log_view_form" model="ir.ui.view">
<field name="name">wt.location.log.form</field>
<field name="model">wt.location.log</field>
<field name="arch" type="xml">
<form string="Location Log">
<header>
<button name="action_geocode" string="Resolve Address" type="object" class="btn-primary"/>
<button name="action_compute_distances" string="Compute Distances" type="object"/>
</header>
<sheet>
<group>
<group string="Location">
<field name="date"/>
<field name="category"/>
<field name="place_name" string="Name"/>
<field name="address"/>
<field name="latitude"/>
<field name="longitude"/>
</group>
<group string="Timing">
<field name="arrived_at" string="Begin Time"/>
<field name="departed_at" string="End Time"/>
<field name="time_at_location" string="Duration (hrs)" widget="float_time"/>
</group>
</group>
<group>
<group string="Travel from Previous Stop">
<field name="distance_from_previous" string="Distance (mi)"/>
<field name="travel_time_from_previous" string="Travel Time (hrs)" widget="float_time"/>
<field name="travel_mode"/>
</group>
<group string="Settings">
<field name="source"/>
<field name="add_to_calendar"/>
<field name="calendar_event_id"/>
</group>
</group>
<group string="Notes">
<field name="notes" nolabel="1"/>
</group>
</sheet>
</form>
</field>
</record>
<!-- Search View -->
<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">
<!-- Full-text search fields -->
<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"/>
<!-- Travel Mode quick filters -->
<separator/>
<filter string="Driving" name="filter_driving" domain="[('travel_mode','=','driving')]"/>
<filter string="Walking" name="filter_walking" domain="[('travel_mode','=','walking')]"/>
<filter string="Cycling" name="filter_cycling" domain="[('travel_mode','=','cycling')]"/>
<filter string="Flying" name="filter_flying" domain="[('travel_mode','=','flying')]"/>
<filter string="Transit" name="filter_transit" domain="[('travel_mode','=','transit')]"/>
<filter string="Unknown" name="filter_unknown" domain="[('travel_mode','=','unknown')]"/>
<!-- Category quick filters -->
<separator/>
<filter string="Home" name="filter_home" domain="[('category','in',['Home'])]"/>
<filter string="Work" name="filter_work" domain="[('category','in',['Work'])]"/>
<!-- Group By -->
<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'}"/>
</group>
</search>
</field>
</record>
<!-- Action -->
<record id="wt_location_log_action" model="ir.actions.act_window">
<field name="name">Location Logs</field>
<field name="res_model">wt.location.log</field>
<field name="view_mode">list,form</field>
<field name="search_view_id" ref="wt_location_log_view_search"/>
</record>
</odoo>