Skip to content

[19.0][MIG] attachment_queue: Migration to 19.0#2

Closed
dnplkndll wants to merge 68 commits into
19.0from
19.0-mig-attachment_queue
Closed

[19.0][MIG] attachment_queue: Migration to 19.0#2
dnplkndll wants to merge 68 commits into
19.0from
19.0-mig-attachment_queue

Conversation

@dnplkndll
Copy link
Copy Markdown

@dnplkndll dnplkndll commented May 19, 2026

Port of attachment_queue from 18.0 to 19.0. Follows the OCA migration guide.

What changed

  • Manifest → 19.0.1.0.0; deleted migrations/18.0.1.0.0/.
  • self._crself.env.cr in attachment_queue.py SQL exec (deprecated in 19).
  • Search view (views/attachment_queue_view.xml):
    • <field> re-ordered to all precede <filter>/<separator>/<group> (19 RelaxNG enforces type-grouped children).
    • <group expand="0" string="Group By"> wrapper removed — group-by filters live at the top level of <search> in 19.
  • Mail template body (data/mail_template.xml): ${object.x}{{object.x}} (Mako removed in 19; Jinja only).
  • W8161: bare _(...)self.env._(...) in tests/test_models.py.
  • Tests refactored from odoo_test_helper.FakeModelLoader → native odoo.orm.model_classes.add_to_registry (instance setUp → setUpClass + addClassCleanup). odoo-test-helper is incompatible with 19 (MetaModel.module_to_models was renamed/privatized).
  • README regenerated.

Test results — --test-tags=/attachment_queue on a local 19.0 doodba stack

6 of 8 tests pass cleanly. Two known follow-ups for maintainer review:

  1. test_run_fails_rollback — fails with empty mail.mail.email_to. The template's {{object.failure_emails}} renders to "" when the fake-model override of _get_failure_emails should return "test@test.com". Looks like a mail-template-render-env behavior change in 19 — the renderer may use the base attachment.queue class rather than the registry-augmented fake class. Maintainer call: patch the test to mock the compute directly, or accept the renderer behavior change.

  2. tearDownClass error — addClassCleanup(cls.registry.__delitem__, "attachment.queue") orphans attachment.queue.reschedule.attachment_ids (M2m → "attachment.queue") on the subsequent _setup_models__ pass. The native 19 add_to_registry teardown doesn't cascade to dependents the way odoo-test-helper did. Needs a more careful cleanup sequence (re-setup after delete, or explicit handling of the dependent).

Suggested for the maintainers @florian-dacosta @sebastienbeau — both reachable via the existing attachment_queue reviewer pool. The substantive 19.0 work (view validation, Mako→Jinja, native test-registry API) is in this PR; both remaining failures are tests-only and tractable with one of you in the loop.

sebastienbeau and others added 30 commits May 19, 2026 14:43
Co-authored-by: Raphaël Valyi <rvalyi@akretion.com>
Refactore the conccurent attachment run, we lock the attachment now instead of using the concurent update concept.
Move the attachment queue menu from settings to Queue app
Fix failure email template
Rename the default attachment channel
* Manifest version → 19.0.1.0.0 (T07).
* self._cr → self.env.cr in models/attachment_queue.py SQL exec
  (T01 — self._cr is deprecated in Odoo 19).
* Delete migrations/18.0.1.0.0/ — pre-migrate script no longer
  applies in 19.0 (T08).
* W8161: bare _(...) → self.env._(...) in tests/test_models.py
  fake-model fixtures (Odoo 19 deprecates direct `_` import).
* Search view (views/attachment_queue_view.xml):
    - <field> elements re-ordered to all precede <filter>/<separator>/<group>
      (Odoo 19 RelaxNG: search view children must be type-grouped).
    - <group expand="0" string="Group By"> wrapper removed — Odoo 19
      group-by filters live at the top level of <search>.
* Mail template body (data/mail_template.xml): ${object.x} → {{object.x}}
  (Mako removed in 19; Jinja is the only supported render syntax).
* Tests refactored from odoo_test_helper.FakeModelLoader → native
  odoo.orm.model_classes.add_to_registry pattern. odoo-test-helper is
  incompatible with 19 (MetaModel.module_to_models renamed/privatized).
  setUp/tearDown collapsed into setUpClass with addClassCleanup.
* README.rst + static/description/index.html regenerated from
  readme/ fragments.

Test results (--test-tags=/attachment_queue on doodba 19 local stack):
6 of 8 tests pass cleanly. Two known follow-ups, NOT addressed here:

  1. test_run_fails_rollback — fails with empty mail.mail.email_to.
     The mail template's `{{object.failure_emails}}` renders to ""
     when the fake-model override of _get_failure_emails should
     return "test@test.com". Looks like a mail-template-render-env
     change in 19 (the renderer may use the base attachment.queue
     class rather than the registry-augmented fake class). Needs
     maintainer judgment — either patch the test to mock the
     compute directly, or accept the mail.template renderer
     behavior change for fake-model inheritance.

  2. tearDownClass error — `addClassCleanup(cls.registry.__delitem__,
     "attachment.queue")` orphans a related model
     attachment.queue.reschedule.attachment_ids (Many2many) on
     subsequent _setup_models__ pass. The native 19 add_to_registry
     teardown doesn't cascade to dependents the way odoo-test-helper
     did. Probably needs a more careful cleanup sequence — re-setup
     after delete, or explicit handling of the dependent model.

Signed-off-by: Don Kendall <dkendall@ledoweb.com>
@dnplkndll dnplkndll force-pushed the 19.0-mig-attachment_queue branch from 2e627ca to 3d2e4b2 Compare May 19, 2026 21:12
dnplkndll added a commit that referenced this pull request May 20, 2026
…ch (temp)

Until #2 merges and the 19.0 wheel publishes, pip-install
attachment_queue from the open migration PR branch via whool. To be reverted
before opening the upstream OCA PR.
dnplkndll added a commit that referenced this pull request May 20, 2026
…en PR branch

Until #2 merges and the 19.0 wheel publishes, pip-install
attachment_queue from the open migration PR branch via whool. Must be reverted
before this PR is filed upstream to OCA.
@dnplkndll
Copy link
Copy Markdown
Author

Filed upstream as OCA#3614 — closing mirror, branch retained.

@dnplkndll dnplkndll closed this May 20, 2026
dnplkndll added a commit that referenced this pull request May 20, 2026
* Manifest version → 19.0.1.0.0 (T07).
* Delete migrations/18.0.1.0.0/ — pre-migrate script no longer applies in 19.0 (T08).
* odoo.osv.expression → odoo.fields.Domain: import + the one expression.AND([d, ...])
  call in run_task_import_scheduler rewritten as variadic Domain.AND(d, ...).
* tracking_disable=True added to SyncCommon.setUpClass test context (covers
  test_export, test_import via inheritance).
* README.rst + static/description/index.html regenerated from readme/ fragments.

CI dep-chain note: attachment_synchronize depends on attachment_queue, which
is not yet on OCA/server-tools 19.0 (it's in #2, our fork
PR awaiting upstream). Until that lands, `test with Odoo` / `test with OCB`
will fail at the install step ("No matching distribution found for
odoo-addon-attachment_queue==19.0.*"). The migration code itself is complete
and reviewable; CI will go green automatically once attachment_queue lands
on OCA/19.0.

Signed-off-by: Don Kendall <dkendall@ledoweb.com>
dnplkndll added a commit that referenced this pull request May 20, 2026
…en PR branch

Until #2 merges and the 19.0 wheel publishes, pip-install
attachment_queue from the open migration PR branch via whool. Must be reverted
before this PR is filed upstream to OCA.
dnplkndll added a commit that referenced this pull request May 20, 2026
* Manifest version → 19.0.1.0.0 (T07).
* Delete migrations/18.0.1.0.0/ — pre-migrate script no longer applies in 19.0 (T08).
* odoo.osv.expression → odoo.fields.Domain: import + the one expression.AND([d, ...])
  call in run_task_import_scheduler rewritten as variadic Domain.AND(d, ...).
* tracking_disable=True added to SyncCommon.setUpClass test context (covers
  test_export, test_import via inheritance).
* README.rst + static/description/index.html regenerated from readme/ fragments.

CI dep-chain note: attachment_synchronize depends on attachment_queue, which
is not yet on OCA/server-tools 19.0 (it's in #2, our fork
PR awaiting upstream). Until that lands, `test with Odoo` / `test with OCB`
will fail at the install step ("No matching distribution found for
odoo-addon-attachment_queue==19.0.*"). The migration code itself is complete
and reviewable; CI will go green automatically once attachment_queue lands
on OCA/19.0.

Signed-off-by: Don Kendall <dkendall@ledoweb.com>
dnplkndll added a commit that referenced this pull request May 20, 2026
…en PR branch

Until #2 merges and the 19.0 wheel publishes, pip-install
attachment_queue from the open migration PR branch via whool. Must be reverted
before this PR is filed upstream to OCA.
dnplkndll added a commit that referenced this pull request May 20, 2026
* Manifest version → 19.0.1.0.0 (T07).
* Delete migrations/18.0.1.0.0/ — pre-migrate script no longer applies in 19.0 (T08).
* odoo.osv.expression → odoo.fields.Domain: import + the one expression.AND([d, ...])
  call in run_task_import_scheduler rewritten as variadic Domain.AND(d, ...).
* tracking_disable=True added to SyncCommon.setUpClass test context (covers
  test_export, test_import via inheritance).
* README.rst + static/description/index.html regenerated from readme/ fragments.

CI dep-chain note: attachment_synchronize depends on attachment_queue, which
is not yet on OCA/server-tools 19.0 (it's in #2, our fork
PR awaiting upstream). Until that lands, `test with Odoo` / `test with OCB`
will fail at the install step ("No matching distribution found for
odoo-addon-attachment_queue==19.0.*"). The migration code itself is complete
and reviewable; CI will go green automatically once attachment_queue lands
on OCA/19.0.

Signed-off-by: Don Kendall <dkendall@ledoweb.com>
dnplkndll added a commit that referenced this pull request May 20, 2026
…en PR branch

Until #2 merges and the 19.0 wheel publishes, pip-install
attachment_queue from the open migration PR branch via whool. Must be reverted
before this PR is filed upstream to OCA.
dnplkndll added a commit that referenced this pull request May 20, 2026
* Manifest version → 19.0.1.0.0 (T07).
* Delete migrations/18.0.1.0.0/ — pre-migrate script no longer applies in 19.0 (T08).
* odoo.osv.expression → odoo.fields.Domain: import + the one expression.AND([d, ...])
  call in run_task_import_scheduler rewritten as variadic Domain.AND(d, ...).
* tracking_disable=True added to SyncCommon.setUpClass test context (covers
  test_export, test_import via inheritance).
* README.rst + static/description/index.html regenerated from readme/ fragments.

CI dep-chain note: attachment_synchronize depends on attachment_queue, which
is not yet on OCA/server-tools 19.0 (it's in #2, our fork
PR awaiting upstream). Until that lands, `test with Odoo` / `test with OCB`
will fail at the install step ("No matching distribution found for
odoo-addon-attachment_queue==19.0.*"). The migration code itself is complete
and reviewable; CI will go green automatically once attachment_queue lands
on OCA/19.0.

Signed-off-by: Don Kendall <dkendall@ledoweb.com>
dnplkndll added a commit that referenced this pull request May 20, 2026
…en PR branch

Until #2 merges and the 19.0 wheel publishes, pip-install
attachment_queue from the open migration PR branch via whool. Must be reverted
before this PR is filed upstream to OCA.
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.