When using Analytic Plans in Odoo 16:
-
A single Journal Item line may have multiple Analytic Accounts from different Analytic Plans .
-
When you filter Journal Items using an Analytic Plan , the system does not restrict the visible or exported Analytic Accounts to that plan.
-
The Excel export shows all Analytic Accounts , often in separate rows — even if you selected a specific Analytic Plan in the UI.
Option 1: Use Pivot View with Custom Filters
-
Go to Accounting > Reporting > Analytic Items or Journal Items .
-
Use Group By > Analytic Plan and Analytic Account .
-
Apply a filter for the specific Analytic Plan you want.
-
Then export the view (Pivot > Download XLSX).
This helps limit the display, but it still might show related accounts across different plans due to internal linking unless filtered deeply.
Option 2: Customize the Export Behavior (Technical)
To filter export data to show only analytic accounts of a specific plan , you'll need to customize the export or the domain logic using code.
Steps:
-
Inherit the account.move.line model.
-
Override the export method (or use server action/wizard) to:
-
Loop over journal items.
-
Fetch only the analytic_line_ids where analytic_account_id.plan_id == selected_plan_id .
-
Structure and export only those accounts.
Here's a simplified example of how the filter might look in code :
filtered_analytic_accounts = move_line.analytic_line_ids.filtered(
lambda l: l.account_id.plan_id.id == selected_plan_id
)
Option 3: Use Studio (Enterprise Only)
If you're using Odoo 16 Enterprise , you can:
-
Add a related field or a custom computed field to show only Analytic Accounts of the selected plan.
-
Hide others from the form/list view.
-
Then export the filtered view using standard export tools.
Thanks & Regards,
Email: contact@datainteger.com