Skip to content

[19.0][MIG] dms_field_auto_classification: Migration to 19.0#14

Open
dnplkndll wants to merge 8 commits into
19.0-mig-dms_fieldfrom
19.0-mig-dms_field_auto_classification
Open

[19.0][MIG] dms_field_auto_classification: Migration to 19.0#14
dnplkndll wants to merge 8 commits into
19.0-mig-dms_fieldfrom
19.0-mig-dms_field_auto_classification

Conversation

@dnplkndll
Copy link
Copy Markdown

@dnplkndll dnplkndll commented May 27, 2026

Port of dms_field_auto_classification from 18.0 to 19.0. See the OCA migration guide.

Depends on ledoent/dms#13 (dms_field).

Non-mechanical adaptations worth flagging

Tests: all env.ref() demo-data references replaced with inline fixtures — OCA CI runs without demo data. setUpClass now creates dms.storage, dms.access.group, dms.field.template (+ manual create_dms_directory()), dms.classification.template, and dms.classification.template.detail directly.

_compute_directory_id recordset-iteration bug fixedwizard_dms_classification.py override used self.parent_id inside the compute loop, where self is the full recordset. On multi-record batches this picks up the wrong wizard, causing the company filter and _get_directory_from_pattern call to silently return nothing. Fixed to item.parent_id.

_search_parents ported to Odoo 19 SQL composable API — The 18.0 implementation called _where_calc(), _apply_ir_rules(), and accessed query.from_clause / query.where_clause as tuples — all removed in 19.0. Rewrote to use self._search(domain, bypass_access=True) (returns a Query) with SQL composable objects throughout. This was a runtime AttributeError on every jstree load in the field widget.

Tests fixed for 3 Odoo 19 API changes surfaced by the clean-DB run:

  • res.groups.users renamed to user_ids
  • fields.first() removed — replaced with recordset[:1]
  • test_creation_process_*_with_parent: using the template's own root dir as parent_directory_id caused infinite recursion in _create_child_directories. Fixed by creating an independent parent dir per test.

New _search_parents test coverage: test_search_parents_count, test_search_parents_limit_offset, test_search_parents_excludes_children — exercise the rewritten SQL path (count, pagination, parent-exclusion clause).

dms module UX housekeeping (code-review findings):

  • dms_directory.scss / portal.scss: extracted $dms-dir-buckets map; replaced 8×2 inline colour rules with @each loops. Portal map was declared after first use — silent no-op in SCSS.
  • portal.xml: replaced broken icon_url img with initials chip matching the backend kanban.
  • file_preview_pane.xml: added ARIA attributes (role, aria-label, aria-busy, aria-live).
  • file_kanban_record.esm.js: add .o_kanban_dms_card--previewing selection ring on click.

Directory preview card (item 5 verification)

Partner form → DMS tab → select a directory node → preview card renders:

DMS tab open

Directory preview card

@dnplkndll dnplkndll force-pushed the 19.0-mig-dms_field branch from f95252f to 12ae1d1 Compare May 27, 2026 12:45
@dnplkndll dnplkndll force-pushed the 19.0-mig-dms_field_auto_classification branch from 142abe0 to 5169526 Compare May 27, 2026 12:46
@dnplkndll dnplkndll force-pushed the 19.0-mig-dms_field branch from 12ae1d1 to 1a226ca Compare May 27, 2026 12:57
@dnplkndll dnplkndll force-pushed the 19.0-mig-dms_field_auto_classification branch from 5169526 to a4d18ed Compare May 27, 2026 12:57
@dnplkndll dnplkndll force-pushed the 19.0-mig-dms_field branch from 1a226ca to 6f4d9ea Compare May 27, 2026 14:33
@dnplkndll dnplkndll force-pushed the 19.0-mig-dms_field_auto_classification branch from a4d18ed to 5130c4f Compare May 27, 2026 14:34
@dnplkndll dnplkndll force-pushed the 19.0-mig-dms_field branch from 6f4d9ea to 278216f Compare May 27, 2026 14:43
@dnplkndll dnplkndll force-pushed the 19.0-mig-dms_field_auto_classification branch from 5130c4f to edf28e2 Compare May 27, 2026 14:45
@dnplkndll dnplkndll force-pushed the 19.0-mig-dms_field branch from 278216f to 50748de Compare May 27, 2026 15:13
@dnplkndll dnplkndll force-pushed the 19.0-mig-dms_field_auto_classification branch from edf28e2 to 7ab9a28 Compare May 27, 2026 15:13
dnplkndll added 2 commits May 27, 2026 11:19
- Rewrote setUpClass to create fixtures inline (storage, dms.access.group,
  dms.field.template, template root directory) — OCA CI runs without demo
  data so env.ref("dms_field.field_template_partner") would fail
… dms_list)

- Add hero_chips named slot to dms.field.template form view
- Replace custom file-node preview in dms_list renderer with FilePreviewPane
  from base DMS (download, open-form, share, extra-action registry)
- Directory-node panel retained; file branch now leverages shared preview
  infrastructure
@dnplkndll dnplkndll force-pushed the 19.0-mig-dms_field branch from 50748de to 87e079f Compare May 27, 2026 15:19
@dnplkndll dnplkndll force-pushed the 19.0-mig-dms_field_auto_classification branch from 7ab9a28 to ead2a41 Compare May 27, 2026 15:19
Wizard:
- _compute_directory_id: use item.parent_id instead of self.parent_id inside
  the recordset loop — self is the full wizard set, not the current item;
  caused silent wrong-company + empty pattern results on multi-record batches
- _compute_file_id: replace removed fields.first(files) with files[:1]

dms_field _search_parents (Odoo 19 SQL composable API):
- _where_calc(), _apply_ir_rules(), and tuple query.from_clause/where_clause
  were removed in 19.0; rewrote using _search(bypass_access=True) + SQL()
  composable objects — was an AttributeError on every jstree load

dms_field tests:
- res.groups field renamed users → user_ids in 19.0
- fields.first() removed — replaced with recordset[:1]
- test_creation_process_*_with_parent: template root dir as parent_directory_id
  caused infinite recursion in _create_child_directories; use independent dir
- new tests: test_search_parents_count, limit_offset, excludes_children

dms / dms_field UX (code-review):
- dms_directory.scss / portal.scss: DRY bucket colour maps with @each loops;
  portal map was declared after first use (silent no-op in SCSS)
- portal.xml: replace broken icon_url img with initials chip (data-bucket hash)
- file_preview_pane.xml: ARIA attrs (role, aria-label, aria-busy, aria-live)
- file_kanban_record.esm.js: .o_kanban_dms_card--previewing selection ring
- dms_list widget: structured directory preview card (chip + 4-stat grid);
  Bootstrap CSS variable tokens for dark-mode; fix #aaaa invalid hex
@dnplkndll dnplkndll force-pushed the 19.0-mig-dms_field_auto_classification branch from d4965b9 to 242e4c4 Compare May 28, 2026 19:27
@dnplkndll dnplkndll force-pushed the 19.0-mig-dms_field branch from 1d6a8eb to 3ebd721 Compare May 29, 2026 19:30
@dnplkndll dnplkndll force-pushed the 19.0-mig-dms_field_auto_classification branch from 86799dc to bdf3c9e Compare May 29, 2026 19:31
@dnplkndll dnplkndll force-pushed the 19.0-mig-dms_field branch from 3ebd721 to 066837a Compare May 29, 2026 19:45
@dnplkndll dnplkndll force-pushed the 19.0-mig-dms_field_auto_classification branch from bdf3c9e to 55ee2fc Compare May 29, 2026 19:46
@dnplkndll dnplkndll force-pushed the 19.0-mig-dms_field branch from 066837a to 38b4bec Compare May 29, 2026 22:00
@dnplkndll dnplkndll force-pushed the 19.0-mig-dms_field_auto_classification branch from 55ee2fc to 95587c3 Compare May 29, 2026 22:00
@dnplkndll dnplkndll force-pushed the 19.0-mig-dms_field_auto_classification branch from 95587c3 to 9367d2b Compare May 30, 2026 14:27
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.

1 participant