Skip to content

[REVIEW] OCA/server-tools#3518: jsonifier migration to 19.0 - #2

Open
weinni2000 wants to merge 2 commits into
19.0-review-pr3518-precommitfrom
19.0-review-pr3518-migration
Open

weinni2000 wants to merge 2 commits into
19.0-review-pr3518-precommitfrom
19.0-review-pr3518-migration

Conversation

@weinni2000

@weinni2000 weinni2000 commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

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:

  • Base: 83e13c82e41bf4f6d054a4acf93358665507acd9
  • Head: 73b03542d05c300fa69682d048780d3e866aa30f

No 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:109 removes 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:

  • Local isolated checkout at the exact upstream head; no source edits.
  • Fresh Odoo 19 Community install without demo data: all 18 module tests passed, zero failures/errors. Tested via odev against Odoo source c5907fc52630465fb728b38f274415f2e85cd575.
  • Repository pre-commit hooks passed for both this comparison and the complete upstream PR. Pylint emits configuration warnings for obsolete check names; the configured mandatory hook passes.
  • README.rst rendered with Docutils at halt_level=2/report_level=2; XML, translations, manifest, generated documentation and icon checked.
  • Upstream pre-commit, dependency, Odoo, OCB, coverage and Runboat checks are green; no prior reviews or unresolved threads.
  • Limits: no browser interaction, local OCB run, or production database upgrade. The local runtime check is a fresh installation.
  • Test database retained: 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:

  • Update the export-line validation error formatting for Odoo 19 compatibility.

Enhancements:

  • Migrate jsonifier test fixtures from demo XML/CSV data to reusable class-level test setup.
  • Update module credits and contributors for the 19.0 migration.

Documentation:

  • Update the module README metadata and rendered description for the 19.0 migration and new sponsorship credits.

Tests:

  • Refactor parser, helper, and export-line tests to use programmatically created fixtures.

Chores:

  • Remove obsolete demo data files and their manifest entries.

@sourcery-ai

sourcery-ai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Implementation

Update the constraint error translation to pass interpolation values as named arguments, matching the Odoo 19 API.

  • jsonifier/models/ir_exports_line.py L55-58

Configuration

Remove the demo-data declaration from the manifest as the XML and CSV fixtures are removed in favor of test setup.

  • jsonifier/__manifest__.py L21 (removed lines)

Documentation

Update the contributor and migration-credit documentation for the Odoo 19 migration.

  • jsonifier/README.rst L266, L271-272
  • jsonifier/readme/CONTRIBUTORS.md L9
  • jsonifier/readme/CREDITS.md L1
  • jsonifier/static/description/index.html L587, L592-593

Tests

Replace demo XML/CSV fixtures with class-level test data setup and update the affected tests to use it.

  • jsonifier/tests/__init__.py L1
  • jsonifier/tests/test_data_setup.py L1-60
  • jsonifier/tests/test_get_parser.py L19-23 (+3 small edits)
  • jsonifier/tests/test_helpers.py L7-14
  • jsonifier/tests/test_ir_exports_line.py L7-15 (+5 small edits)
  • jsonifier/demo/export_demo.xml (deleted)
  • jsonifier/demo/ir.exports.line.csv (deleted)
  • jsonifier/demo/resolver_demo.xml (deleted)

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

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(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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`.

Comment thread jsonifier/__manifest__.py
Comment on lines -21 to -24
"demo": [
"demo/resolver_demo.xml",
"demo/export_demo.xml",
"demo/ir.exports.line.csv",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants