Skip to content

Commit 3ff6f60

Browse files
bosdbosd
authored andcommitted
[DOCS] Extend roadmap, advanced pre-flight check.
1 parent b94aa8e commit 3ff6f60

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

docs/ROADMAP.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,62 @@ This document outlines the planned future enhancements and major refactoring eff
2626
- **Tasks:**
2727
- Add E2E test which perform an actual import /export.
2828
* **On Pull Requests to `main` / After Merging:** Run the slow E2E integration tests. This ensures that only fully validated code gets into your main branch, without slowing down the development process for every small change.
29+
30+
Advanced Pre-flight Check: Smart Field Verification
31+
---------------------------------------------------
32+
33+
* **Status:** Planned
34+
35+
* **Priority:** Medium
36+
37+
* **Complexity:** High
38+
39+
40+
### Description
41+
42+
This feature will expand on the basic --verify-fields check to create a much more intelligent "pre-flight" validation system. Before starting a large import, the tool would not only check if the target fields exist but would also inspect their properties to prevent a wider range of common import errors.
43+
44+
The goal is to fail fast with clear, human-readable error messages, saving developers from discovering these issues halfway through a long import process.
45+
46+
### Key Validations to Implement
47+
48+
The "Smart Field Verification" would check for the following common error scenarios:
49+
50+
1. **Importing into Read-Only Fields:**
51+
52+
* **Check:** The tool would verify if any field in the import file is marked as readonly=True or compute=True in Odoo.
53+
54+
* **Error Message:** Error: You are trying to import data into the field 'price\_total', which is a computed (read-only) field. You should import the source fields (e.g., 'price\_unit', 'product\_uom\_qty') instead.
55+
56+
2. **Data Type Mismatches:**
57+
58+
* **Check:** The tool would perform a basic check to see if the data in a column is compatible with the target field's type (ttype in Odoo).
59+
60+
* **Examples:**
61+
62+
* It would warn if a column being mapped to a Many2one or Many2many field does not have the required /id suffix.
63+
64+
* It would warn if a column being mapped to an Integer or Float field contains non-numeric characters.
65+
66+
* **Error Message:** Warning: The column 'partner\_id' appears to be a relational field but is missing the '/id' suffix. The correct header is 'partner\_id/id'.
67+
68+
3. **Selection Field Value Check:**
69+
70+
* **Check:** For Selection fields, the tool could fetch the list of valid keys from Odoo and check if the values in the source CSV are all valid.
71+
72+
* **Error Message:** Error: The value 'Shipped' in column 'delivery\_status' is not a valid key for the selection field. Valid keys are: 'draft', 'in\_progress', 'done'.
73+
74+
75+
### Implementation Plan
76+
77+
This would be implemented via a new, more powerful command-line flag, for example, --validate-mapping. When this flag is used, the run\_import orchestrator would:
78+
79+
1. Connect to the Odoo instance.
80+
81+
2. Fetch the complete field definitions for the target model from ir.model.fields, including name, ttype, readonly, and compute.
82+
83+
3. For Selection fields, it would perform an additional query to get the valid keys.
84+
85+
4. It would then iterate through the header of the source CSV file and perform the series of checks described above.
86+
87+
5. If any check fails, it would abort the import immediately with a clear, actionable error message.

0 commit comments

Comments
 (0)