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 linesMaintenance 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
| Model | Field | Purpose |
|---|---|---|
stock.location | is_track_analytics | Enables analytic tracking for moves to/from this location |
stock.picking | analytic_account | JSON analytic distribution on the transfer header |
stock.picking | maintanence_request_id | Links picking to a service request |
stock.move | analytic_distribution | JSON analytic distribution per move line |
maintenance.request | picking_ids / picking_count | Related 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
- Go to Inventory > Configuration > Locations
- Open the location you want to track (e.g., HOU/Stock)
- Check Is Track Analytics in the Additional Info section
- Transfers to/from this location will now show analytic distribution fields
Test Plan
Location flag
| # | Test | Expected Result |
|---|---|---|
| 01 | Enable "Is Track Analytics" on a stock location | Flag saves on the location record |
| 02 | Create a transfer TO a flagged location | Analytic distribution field appears on the picking |
| 03 | Create a transfer FROM a flagged location | Analytic distribution field appears on the picking |
| 04 | Create a transfer between two unflagged locations | No analytic distribution field visible |
Analytic distribution
| # | Test | Expected Result |
|---|---|---|
| 05 | Set analytic distribution on picking header | Distribution propagates to all move lines |
| 06 | Edit analytic distribution on an individual move line | Only that line changes, others keep header value |
| 07 | Validate the picking | Journal entry debit lines carry the analytic distribution |
| 08 | Validate picking with no analytic distribution set | Journal entry posts normally, no analytics |
Maintenance request linkage
| # | Test | Expected Result |
|---|---|---|
| 09 | Link a picking to a service request | Service request field populated on picking |
| 10 | Check stat button on service request | Pickings count shows, clicking opens the list |
| 11 | Create a new picking from the service request stat button | New picking pre-filled with service request link |
Search functionality
| # | Test | Expected Result |
|---|---|---|
| 12 | Click "Search Moves" on picking list, select an analytic account | List filters to pickings containing moves with that account |
Cascade delete
| # | Test | Expected Result |
|---|---|---|
| 13 | Delete a service request that has linked pickings | Pickings should NOT be deleted (currently they are, see Known Issues) |
Known Issues
Typo in field name.
maintanence_request_idis 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.Cascade delete risk. The
maintanence_request_idfield usesondelete='cascade'. If a service request is deleted, all linked pickings get deleted. That's inventory data gone. Should beondelete='set null'. Fix before launch.
Cross-Module Dependencies
| Module | Relationship |
|---|---|
nugget_service_requests | Service 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 |