Skip to content

[18.0][ADD] fleet_vehicle_analytic_purchase: add new module - #235

Open
CristianoMafraJunior wants to merge 1 commit into
OCA:18.0from
Escodoo:18.0-add-fleet_vehicle_analytic_purchase
Open

CristianoMafraJunior wants to merge 1 commit into
OCA:18.0from
Escodoo:18.0-add-fleet_vehicle_analytic_purchase

Conversation

@CristianoMafraJunior

@CristianoMafraJunior CristianoMafraJunior commented Sep 8, 2026 •

Copy link
Copy Markdown
Member

@Escodoo HT02193

Summary

Adds fleet_vehicle_analytic_purchase, a new module linking fleet vehicles to
analytic accounts (cost centers) and exposing the purchase orders that share
one of those accounts directly from the vehicle form.

Why

fleet.vehicle has no built-in way to track which analytic account(s) /
cost center(s) a vehicle belongs to, and there is no built-in way to jump
from a vehicle to the purchase orders associated with it. Separately,
analytic_distribution (on purchase.order / purchase.order.line) is
stored as JSON, so it doesn't get the usual "type and pick a suggested
record" Many2one search experience in the UI — only plain text matching.

What it does

  • Adds analytic.mixin to fleet.vehicle, so each vehicle can carry an
    analytic_distribution (one or more cost centers).
  • Adds a "Purchase Orders" stat button on the vehicle form, showing the
    count of purchase orders that share an analytic account with the vehicle,
    with an action to open them filtered accordingly.
  • Adds a small, non-stored, search-only analytic_account_id Many2one field
    (via a shared analytic.account.search.mixin) on purchase.order and
    purchase.order.line, redirecting search to the existing
    distribution_analytic_account_ids field. This gives Requests for
    Quotation, Purchase Orders and Purchase Order Lines search views the same
    "pick a suggested record" UX already used for Vendor/Product, without
    duplicating or storing any data.
  • Exposes analytic_account_id in the three search views above.

Dependencies

Depends on purchase_analytic_global for the header-level
analytic_distribution field on purchase.order (rather than
purchase_analytic, which provides the same field through a separate,
overlapping implementation — using both in the same database duplicates the
field and its compute/inverse logic).

cc @marcelsavegnago @WesleyOliveira98 @MarcusPDL @medicegabriel

@OCA-git-bot OCA-git-bot added series:18.0 mod:fleet_vehicle_analytic_purchase Module fleet_vehicle_analytic_purchase labels Sep 8, 2026
@CristianoMafraJunior
CristianoMafraJunior marked this pull request as draft September 8, 2026 16:47
@CristianoMafraJunior
CristianoMafraJunior force-pushed the 18.0-add-fleet_vehicle_analytic_purchase branch from e43582c to 58ffa46 Compare September 14, 2026 11:53
@CristianoMafraJunior
CristianoMafraJunior force-pushed the 18.0-add-fleet_vehicle_analytic_purchase branch from 58ffa46 to f576019 Compare October 13, 2026 13:51
@CristianoMafraJunior
CristianoMafraJunior marked this pull request as ready for review October 13, 2026 14:02

@marcelsavegnago marcelsavegnago left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@WesleyOliveira98 WesleyOliveira98 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@OCA-git-bot

Copy link
Copy Markdown
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants