Repository navigation
[REVIEW] OCA/server-tools#3518: jsonifier migration to 19.0 - #2
weinni2000 wants to merge 2 commits into
Conversation
Reviewer's GuideImplementationUpdate the constraint error translation to pass interpolation values as named arguments, matching the Odoo 19 API.
ConfigurationRemove the demo-data declaration from the manifest as the XML and CSV fixtures are removed in favor of test setup.
DocumentationUpdate the contributor and migration-credit documentation for the Odoo 19 migration.
TestsReplace demo XML/CSV fixtures with class-level test data setup and update the affected tests to use it.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="jsonifier/tests/test_get_parser.py" line_range="113" />
<code_context>
+ exporter = self.ir_exp_partner
- # modify an ir.exports_line to put a target for a field
- self.env.ref("jsonifier.category_id_name").write(
- {"target": "category_id:category/name"}
- )
</code_context>
<issue_to_address>
**In-transaction edits keep stale targets**
When an export line is edited after its parser is cached in the same transaction, the export line’s `write_date` stays at the transaction timestamp, so `get_json_parser()` reuses the cached parser and exports keep using the old target; without an edit-and-reparse assertion, the suite passes.
Restore a test that generates the parser, edits the target, generates the parser again in the same transaction, and asserts the updated result.
Also at `jsonifier/tests/test_get_parser.py:115`.
</issue_to_address>
### Comment 2
<location path="jsonifier/__manifest__.py" line_range="21-24" />
<code_context>
"views/ir_exports_view.xml",
"views/ir_exports_resolver_view.xml",
],
- "demo": [
- "demo/resolver_demo.xml",
- "demo/export_demo.xml",
- "demo/ir.exports.line.csv",
- ],
}
</code_context>
<issue_to_address>
**Demo installs lose sample exports**
When a user installs the module with demo data enabled, the manifest no longer loads the sample export, resolver, or CSV records, so demo-enabled installations have no packaged example configuration for users exploring the module.
Retain the packaged examples as demo data while keeping unit tests independent by creating their own fixtures.
</issue_to_address>Sourcery assessment
Approval pending. 2 findings to address first.
Blocking findings: jsonifier/tests/test_get_parser.py:113, jsonifier/__manifest__.py:24
| exporter = self.ir_exp_partner | ||
|
|
||
| # modify an ir.exports_line to put a target for a field | ||
| self.env.ref("jsonifier.category_id_name").write( |
There was a problem hiding this comment.
🟡 Medium · In-transaction edits keep stale targets
When an export line is edited after its parser is cached in the same transaction, the export line’s write_date stays at the transaction timestamp, so get_json_parser() reuses the cached parser and exports keep using the old target; without an edit-and-reparse assertion, the suite passes.
Restore a test that generates the parser, edits the target, generates the parser again in the same transaction, and asserts the updated result.
Also at jsonifier/tests/test_get_parser.py:115.
Prompt for AI agents
In `jsonifier/tests/test_get_parser.py` at line 113:
**In-transaction edits keep stale targets**
When an export line is edited after its parser is cached in the same transaction, the export line’s `write_date` stays at the transaction timestamp, so `get_json_parser()` reuses the cached parser and exports keep using the old target; without an edit-and-reparse assertion, the suite passes.
Restore a test that generates the parser, edits the target, generates the parser again in the same transaction, and asserts the updated result.
Also at `jsonifier/tests/test_get_parser.py:115`.| "demo": [ | ||
| "demo/resolver_demo.xml", | ||
| "demo/export_demo.xml", | ||
| "demo/ir.exports.line.csv", |
There was a problem hiding this comment.
🟡 Medium · Demo installs lose sample exports
When a user installs the module with demo data enabled, the manifest no longer loads the sample export, resolver, or CSV records, so demo-enabled installations have no packaged example configuration for users exploring the module.
Retain the packaged examples as demo data while keeping unit tests independent by creating their own fixtures.
Prompt for AI agents
In `jsonifier/__manifest__.py` at lines 21-24:
**Demo installs lose sample exports**
When a user installs the module with demo data enabled, the manifest no longer loads the sample export, resolver, or CSV records, so demo-enabled installations have no packaged example configuration for users exploring the module.
Retain the packaged examples as demo data while keeping unit tests independent by creating their own fixtures.
Review of OCA#3518 (jsonifier migration to Odoo 19).
This comparison starts after the preparation/pre-commit commit and includes the demo-fixture refactor and final migration fix:
83e13c82e41bf4f6d054a4acf93358665507acd973b03542d05c300fa69682d048780d3e866aa30fNo blocking migration regressions found. Reviewed the full upstream module addition, all four commits, and every hunk in this focused comparison. Odoo 19 safe_eval mutates its context dictionary without nocopy; Environment._ accepts the named interpolation used by the corrected constraint. Resolver CRUD remains restricted to Settings administrators, and ORM reads retain the caller's access rights. Demo XML/CSV fixtures are replaced by class-level test setup.
Nonblocking follow-up:
jsonifier/tests/test_get_parser.py:109removes the assertion that changes a target after generating a parser. A supplementary shell probe reproduced stale output when a line is created, parsed and modified in the same transaction: the write_date-based cache key does not change. The cache implementation is unchanged from the initial imported snapshot (4e14d34a13fcefa900e8c6c62bb3b7002129b14c), and Odoo 18 also uses transaction timestamps, so this is inherited rather than introduced here. A probe simulating an export from an earlier transaction confirmed target updates work. Consider a separate cache-invalidation fix and restoring that regression coverage.Validation:
c5907fc52630465fb728b38f274415f2e85cd575.review_jsonifier_3518_20261116.Guidelines read: Odoo review; module structure; manifest; Python imports/naming/translations; ORM recordsets/context, computes, extension points and transactions; fields; XML views/inheritance; access rights; performance; tests; comments; stable-version scope; Odoo security; web guideline applicability (only static description assets here); odev; Odoo completion/pre-commit memory.
Keep this comparison PR open for review; do not merge its preparation base.
Summary by Sourcery
Migrate jsonifier to Odoo 19 while modernizing test data setup and updating module metadata.
Bug Fixes:
Enhancements:
Documentation:
Tests:
Chores: