Analytic Distribution Errors in Odoo
Odoo 17+ replaced the single analytic account field with analytic distribution, allowing costs to be split across multiple analytic accounts. Common errors:
ValidationError: The analytic distribution must equal 100%.
Current total: 80%.
UserError: An analytic distribution is required on account '6100 - Expenses'.
Warning: The analytic plan 'Department' is mandatory for this account.
Please fill in the analytic distribution.
KeyError: Analytic account 'Project Alpha' not found in plan 'Projects'.Understanding Analytic Distribution
In Odoo 17+, analytic distribution is a JSON field that stores percentage allocations:
# Example distribution:
# 60% to Project A + 40% to Project B
{"project_a_id": 60, "project_b_id": 40} # Must total 100%
# The distribution is set on:
# - Invoice lines
# - Journal entry lines
# - Purchase order lines
# - Sale order linesFix 1: Distribution Does Not Equal 100%
# Error: total is 80%, needs to be 100%
# Check the distribution on the line:
# Click the analytic distribution icon on the invoice/journal line
# Verify percentages add up to 100%
# Common mistake: setting 50% to one account and forgetting the rest
# Fix: adjust percentages to total 100%
# Or set 100% to a single analytic accountFix 2: Mandatory Analytic Distribution
# Certain accounts may require analytic distribution
# This is configured per analytic plan:
# Accounting > Configuration > Analytic Plans
# Open the plan > "Applicability" tab
# Check rules like:
# Account Prefix: 6 → All expense accounts (starting with 6)
# Applicability: Mandatory
# This means any journal entry line on a 6xxx account
# MUST have an analytic distribution for this plan
# Fix options:
# 1. Add the required analytic distribution to the line
# 2. Change the applicability rule from Mandatory to Optional
# 3. Set a default analytic distribution on the accountFix 3: Default Analytic Distribution
# Set default distribution to avoid manual entry:
# On products:
# Sales tab > Analytic Distribution (for revenue)
# Purchase tab > Analytic Distribution (for costs)
# On accounts:
# Chart of Accounts > select account > Default Analytic Distribution
# This automatically applies when the account is used
# On journals:
# Configuration > Journals > Analytic Distribution
# Applied to all entries in this journalFix 4: Analytic Account Not Found
# Error: analytic account not found in plan
# The analytic account may be archived or in a different plan
# Check existing analytic accounts:
sudo -u postgres psql -d mydb -c "
SELECT aa.name, ap.name as plan, aa.active
FROM account_analytic_account aa
JOIN account_analytic_plan ap ON aa.plan_id = ap.id
WHERE aa.company_id = YOUR_COMPANY_ID
ORDER BY ap.name, aa.name;
"
# If archived, reactivate:
# Accounting > Configuration > Analytic Accounts
# Remove 'Active' filter > find the account > UnarchiveFix 5: Migration from Odoo 16 to 17+
# Odoo 16 used a single Many2one field: analytic_account_id
# Odoo 17+ uses a JSON field: analytic_distribution
# After upgrade, old analytic accounts should be migrated automatically
# If they're missing, check the migration:
sudo -u postgres psql -d mydb -c "
SELECT COUNT(*) as lines_without_analytics
FROM account_move_line
WHERE analytic_distribution IS NULL
AND account_id IN (
SELECT id FROM account_account WHERE account_type LIKE 'expense%'
);
"
# Manual migration for custom modules:
# Update the field from old format to new:
# Old: analytic_account_id = 5
# New: analytic_distribution = {"5": 100}Fix 6: Multi-Plan Distribution
# Odoo supports multiple analytic plans (e.g., Projects + Departments)
# Each plan can have its own mandatory rules
# A line might need distribution across multiple plans:
# Project plan: Project Alpha → 100%
# Department plan: Engineering → 60%, Sales → 40%
# Combined distribution:
{"project_alpha_id": 100, "engineering_id": 60, "sales_id": 40}
# Each plan's total should be 100%, but Odoo validates per-planPrevention
DeployMonkey's AI agent configures analytic plans and applicability rules during setup. Default distributions are set on frequently used accounts and products to minimize manual entry and validation errors.