fleet icon indicating copy to clipboard operation
fleet copied to clipboard

[18.0][ADD]fleet_traffic_infraction: new module

Open rpsjr opened this issue 3 months ago • 3 comments

Depends on #184

Motivation

This module introduces a framework for the comprehensive management of traffic infractions within a vehicle fleet. Many companies struggle to track fines, identify the responsible driver, and manage the lifecycle of an infraction from notification to resolution.

The primary motivation is to create a foundational module that focuses exclusively on the operational aspects of infraction management. It provides the necessary tools to record infractions accurately, link them to the correct vehicle, and, most importantly, suggest the driver who was in charge of the vehicle at the time of the incident.

This module intentionally separates the operational tracking from the financial transactions. This approach creates a lean and focused base module, fleet_traffic_infractions, upon which financial modules, such as an accounting integration, can be built.

Implementation

To achieve this, the module implements the following:

    **New Models:**
    fleet.traffic.infractions: The central model to record all details of an infraction, including the vehicle, driver, issuing agency, date, fine amount, and status (Draft, Confirmed, Canceled).
    fleet.traffic.infraction.type: A model to categorize and define different types of infractions with codes, descriptions, and jurisdictional details.
    
    **Driver Suggestion Logic:**
    Leveraging the fleet_vehicle_assignation_log_datetime module, it automatically suggests the driver who was assigned to the vehicle at the exact date and time the infraction occurred.
    If a user manually changes the suggested driver, a log note is automatically posted in the chatter, providing a clear audit trail and highlighting any discrepancies with the vehicle's assignment history.
    
    **Integration with Existing Models:**
    Vehicle Form: A new smart button on the fleet.vehicle form shows the total count of infractions for that vehicle and provides a direct link to view them.
    Partner Form: The res.partner model is enhanced to:
    Identify a partner as a "Traffic Issuing Agency."
    Display smart buttons for viewing infractions where the partner was the driver or the issuing agency.
    Calculate the total fine amount attributed to a partner as a driver.
    
    **User Experience:**
    Provides dedicated menu items to access and manage infraction types and the infractions themselves.
    Includes security groups for standard users (read-only) and fleet managers (full access).

This module serves as the definitive record for what happened, who was responsible, and the operational status of the fine. All accounting-related features, such as creating bills or invoices, are explicitly out of scope.

Roadmap This module is the first step in a two-part plan for complete traffic infraction management. The next step will be the creation of the fleet_traffic_infractions_account module, which will build directly on this foundation.

The future accounting module will be responsible for:

  • Creating a Vendor Bill from an infraction (or a generic accout.move), payable to the "Issuing Agency."
  • Creating a Customer Invoice to charge the fine and any administrative fees to the responsible driver or a third party.
  • Tracking the payment status of fines.
  • Linking infractions directly to their corresponding journal entries for full financial traceability.

rpsjr avatar Sep 17 '25 16:09 rpsjr

ping @marcelsavegnago @ivantodorovich @mamcode

rpsjr avatar Sep 25 '25 14:09 rpsjr

@rpsjr Could you please edit the commit message?

[18.0][ADD]fleet_traffic_infraction: new module

to

[ADD]fleet_traffic_infraction: new module

marcelsavegnago avatar Sep 26 '25 16:09 marcelsavegnago

@rpsjr Could you please edit the commit message?

[18.0][ADD]fleet_traffic_infraction: new module

to

[ADD]fleet_traffic_infraction: new module

Made it

rpsjr avatar Sep 30 '25 21:09 rpsjr