Files
Odoo-Modules/fusion-plating/fusion_plating_logistics/views/fp_route_views.xml
gsinghpal be611876ad changes
2026-04-12 09:09:50 -04:00

190 lines
8.9 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2026 Nexa Systems Inc.
License OPL-1 (Odoo Proprietary License v1.0)
Part of the Fusion Plating product family.
-->
<odoo>
<record id="view_fp_route_list" model="ir.ui.view">
<field name="name">fp.route.list</field>
<field name="model">fusion.plating.route</field>
<field name="arch" type="xml">
<list string="Routes"
decoration-muted="state == 'cancelled'"
decoration-success="state == 'completed'"
decoration-primary="state == 'in_progress'">
<field name="name"/>
<field name="route_date"/>
<field name="driver_id"/>
<field name="vehicle_id"/>
<field name="stop_count"/>
<field name="total_km"/>
<field name="state" widget="badge"
decoration-info="state == 'draft'"
decoration-warning="state == 'planned'"
decoration-primary="state == 'in_progress'"
decoration-success="state == 'completed'"
decoration-muted="state == 'cancelled'"/>
</list>
</field>
</record>
<record id="view_fp_route_form" model="ir.ui.view">
<field name="name">fp.route.form</field>
<field name="model">fusion.plating.route</field>
<field name="arch" type="xml">
<form string="Route">
<header>
<button name="action_plan" string="Plan" type="object"
class="oe_highlight" invisible="state != 'draft'"/>
<button name="action_start" string="Start Route" type="object"
class="oe_highlight" invisible="state != 'planned'"/>
<button name="action_complete" string="Complete" type="object"
invisible="state != 'in_progress'"/>
<button name="action_cancel" string="Cancel" type="object"
invisible="state in ('completed','cancelled')"/>
<button name="action_reset_to_draft" string="Reset to Draft" type="object"
invisible="state not in ('cancelled','planned')"/>
<field name="state" widget="statusbar"
statusbar_visible="draft,planned,in_progress,completed"/>
</header>
<sheet>
<div class="oe_title">
<label for="name"/>
<h1><field name="name" readonly="1"/></h1>
</div>
<group>
<group>
<field name="route_date"/>
<field name="driver_id"/>
<field name="vehicle_id"/>
<field name="company_id" groups="base.group_multi_company"/>
</group>
<group>
<field name="start_time" readonly="1"/>
<field name="end_time" readonly="1"/>
<field name="total_km"/>
</group>
</group>
<notebook>
<page string="Stops">
<field name="stop_ids">
<list editable="bottom">
<field name="sequence" widget="handle"/>
<field name="stop_type"/>
<field name="pickup_request_id"/>
<field name="delivery_id"/>
<field name="address_id"/>
<field name="planned_time"/>
<field name="actual_time"/>
<field name="state" widget="badge"
decoration-info="state == 'pending'"
decoration-warning="state == 'arrived'"
decoration-success="state == 'completed'"
decoration-muted="state == 'skipped'"/>
</list>
</field>
</page>
<page string="Notes">
<field name="notes"/>
</page>
</notebook>
</sheet>
<chatter/>
</form>
</field>
</record>
<record id="view_fp_route_kanban" model="ir.ui.view">
<field name="name">fp.route.kanban</field>
<field name="model">fusion.plating.route</field>
<field name="arch" type="xml">
<kanban default_group_by="state" class="o_fp_route_kanban">
<field name="id"/>
<field name="name"/>
<field name="route_date"/>
<field name="driver_id"/>
<field name="vehicle_id"/>
<field name="stop_count"/>
<field name="total_km"/>
<templates>
<t t-name="card">
<div class="o_fp_card">
<div class="d-flex align-items-start justify-content-between">
<div>
<strong class="o_fp_card_title"><field name="name"/></strong>
<div class="small text-muted"><field name="route_date"/></div>
</div>
<i class="fa fa-road text-muted" aria-hidden="true"/>
</div>
<div class="mt-2 small">
<field name="driver_id"/>
</div>
<div class="mt-1 small text-muted">
<field name="vehicle_id"/>
</div>
<div class="mt-2 d-flex gap-3 small">
<div><strong><field name="stop_count"/></strong> stops</div>
<div><strong><field name="total_km"/></strong> km</div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<record id="view_fp_route_calendar" model="ir.ui.view">
<field name="name">fp.route.calendar</field>
<field name="model">fusion.plating.route</field>
<field name="arch" type="xml">
<calendar string="Routes" date_start="route_date" mode="month" color="driver_id">
<field name="driver_id"/>
<field name="vehicle_id"/>
<field name="state"/>
</calendar>
</field>
</record>
<record id="view_fp_route_search" model="ir.ui.view">
<field name="name">fp.route.search</field>
<field name="model">fusion.plating.route</field>
<field name="arch" type="xml">
<search string="Routes">
<field name="name"/>
<field name="driver_id"/>
<field name="vehicle_id"/>
<filter name="filter_today" string="Today" domain="[('route_date','=', context_today().strftime('%Y-%m-%d'))]"/>
<filter name="filter_draft" string="Draft" domain="[('state','=','draft')]"/>
<filter name="filter_in_progress" string="In Progress" domain="[('state','=','in_progress')]"/>
<filter name="filter_completed" string="Completed" domain="[('state','=','completed')]"/>
<group>
<filter name="group_state" string="Status" context="{'group_by':'state'}"/>
<filter name="group_driver" string="Driver" context="{'group_by':'driver_id'}"/>
<filter name="group_vehicle" string="Vehicle" context="{'group_by':'vehicle_id'}"/>
<filter name="group_date" string="Route Date" context="{'group_by':'route_date'}"/>
</group>
</search>
</field>
</record>
<record id="action_fp_route" model="ir.actions.act_window">
<field name="name">Routes</field>
<field name="res_model">fusion.plating.route</field>
<field name="view_mode">kanban,list,calendar,form</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Plan your first route
</p>
<p>
A route combines multiple pickups and deliveries into a
single run for one driver and vehicle. Drag stops to
re-order, track actual vs planned times, and capture
total distance for costing.
</p>
</field>
</record>
</odoo>