Skip to content

Track Location Analytics

Tracks parts and accessories consumed on service work back to the customer's service contract. When an FSE uses a part on a job, this module ensures the cost posts to the right contract's analytic account so we can see the true cost of servicing each contract. Built by J2E.

Why This Exists

We need to answer: "How much did it cost us in parts to service this contract?" Standard Odoo tracks analytics on purchases and sales, but when parts are consumed on a service call (pulled from warehouse, shipped to a site, swapped during a PM), those costs don't automatically land on the contract's analytic account. This module bridges that gap.

It links inventory transfers to service requests and tags each stock move with the contract's analytic distribution. When the move posts to the GL, the parts cost shows up on the right contract in the P&L.

How It Works

Flagging locations for analytics

Any stock location can be flagged with "Is Track Analytics." When a transfer involves a flagged location (source or destination), the analytic distribution field appears on the picking and its move lines.

Analytic distribution flow

User flags a warehouse location as "Is Track Analytics"
  > Transfer created to/from that location
    > Analytic distribution field appears on picking header
      > User sets the distribution (e.g., 100% to Project X)
        > Distribution propagates to individual move lines
          > When picking is validated, distribution posts to journal entry debit lines

Maintenance request linkage

Each stock picking can be linked to a maintenance request (service request). The service request form shows a "Pickings" stat button with a count of linked transfers.

Key Fields

ModelFieldPurpose
stock.locationis_track_analyticsEnables analytic tracking for moves to/from this location
stock.pickinganalytic_accountJSON analytic distribution on the transfer header
stock.pickingmaintanence_request_idLinks picking to a service request
stock.moveanalytic_distributionJSON analytic distribution per move line
maintenance.requestpicking_ids / picking_countRelated transfers and stat button

Key Views

  • Stock location form - "Is Track Analytics" checkbox in Additional Info
  • Stock picking form - Analytic Account field (visible when location is tracked), Maintenance Request field
  • Stock picking list - Custom JS "Search Moves" button to filter by analytic account
  • Maintenance request form - Pickings stat button (truck icon)

Configuration

  1. Go to Inventory > Configuration > Locations
  2. Open the location you want to track (e.g., HOU/Stock)
  3. Check Is Track Analytics in the Additional Info section
  4. Transfers to/from this location will now show analytic distribution fields

Test Plan

Location flag

#TestExpected Result
01Enable "Is Track Analytics" on a stock locationFlag saves on the location record
02Create a transfer TO a flagged locationAnalytic distribution field appears on the picking
03Create a transfer FROM a flagged locationAnalytic distribution field appears on the picking
04Create a transfer between two unflagged locationsNo analytic distribution field visible

Analytic distribution

#TestExpected Result
05Set analytic distribution on picking headerDistribution propagates to all move lines
06Edit analytic distribution on an individual move lineOnly that line changes, others keep header value
07Validate the pickingJournal entry debit lines carry the analytic distribution
08Validate picking with no analytic distribution setJournal entry posts normally, no analytics

Maintenance request linkage

#TestExpected Result
09Link a picking to a service requestService request field populated on picking
10Check stat button on service requestPickings count shows, clicking opens the list
11Create a new picking from the service request stat buttonNew picking pre-filled with service request link

Search functionality

#TestExpected Result
12Click "Search Moves" on picking list, select an analytic accountList filters to pickings containing moves with that account

Cascade delete

#TestExpected Result
13Delete a service request that has linked pickingsPickings should NOT be deleted (currently they are, see Known Issues)

Known Issues

  1. Typo in field name. maintanence_request_id is misspelled in J2E's code. Don't rename it (would break the database column). Just know it's "maintanence" not "maintenance" when referencing in code.

  2. Cascade delete risk. The maintanence_request_id field uses ondelete='cascade'. If a service request is deleted, all linked pickings get deleted. That's inventory data gone. Should be ondelete='set null'. Fix before launch.

Cross-Module Dependencies

ModuleRelationship
nugget_service_requestsService requests that pickings link to
account_accountant (Odoo)GL posting of analytic distributions
stock (Odoo)Inventory transfers and move lines
maintenance (Odoo)Maintenance request model

Nugget Scientific internal documentation