Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ

Dear All,

We have filtered the Journal Item with respect to Analytical Plan, But Journal Item shows all the Analytical accounts irrespective of the Analytic Plan we selected for each transaction.

When we download the data from Journal Item, it extracts all Anlytic account in various plans and shows in multiple rows in excel. 


Is it possible to show/extract Analytic account only for the selected Analytic Plan in journal Item? Please suggest

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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
  1. Go to Accounting > Reporting > Analytic Items or Journal Items .
  2. Use Group By > Analytic Plan and Analytic Account .
  3. Apply a filter for the specific Analytic Plan you want.
  4. 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:

  1. Inherit the account.move.line model.
  2. 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

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 7 24
29
0
thg 9 24
2071
0
thg 8 25
7
1
thg 8 25
90
1
thg 8 25
193