Skip to content

Task 2.1: Implement Active Record Filtering* #5

@bosd

Description

@bosd

Task 2.1: Implement Active Record Filtering

Goal: Add the logic to odoo-data-flow to prevent inactive records from being migrated.
Prompt for AI Coding Agent:
Context:
Following section 4.1 of the Project Constitution, you need to enhance odoo-data-flow with a feature to filter out "dead" or "inactive" records before the main export. This logic must be efficient and offload the analysis from the source production server.

Use the j-base branch

Requirements:

  1. Create a new flow type or command in odoo-data-flow for "Offline Analysis".
  2. This flow will perform several lightweight exports from the source DB (e.g., res.partner IDs and create_date, sale.order partner_id and date_order, etc.).
  3. Implement a Polars script that takes these exported files as input. This script must:
    • Join the datasets to find the last interaction date for each master record (e.g., each partner).
    • Apply the filtering logic (e.g., last_interaction_date < 2 years ago AND create_date < 2 years ago).
    • Output a simple text file containing only the database IDs of the records identified as inactive.
  4. Modify the main export logic in odoo-data-flow so that it can take the path to this inactive_ids.txt file as an argument. It must then dynamically add a ('id', 'not in', [list_of_ids]) clause to its export domain.
  5. Ensure the logic also respects a manual override field x_odf_force_include by adding | ('x_odf_force_include', '=', True) to the final domain.

Deliverable:
Provide the Python code for the new analysis script and show how the main export function in odoo-data-flow would be modified to use the generated exclusion list.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions