forked from OdooDataFlow/odoo-data-flow
-
Notifications
You must be signed in to change notification settings - Fork 1
Task 2.1: Implement Active Record Filtering* #5
Copy link
Copy link
Open
Description
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:
- Create a new flow type or command in odoo-data-flow for "Offline Analysis".
- 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.).
- 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.
- 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.
- 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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels