Skip to content

Commit ed1b3c0

Browse files
committed
[19.0][FIX] dms: address review findings on the 18.0→19.0 migration
Three regressions identified during code review of the migration commit ([19.0][MIG] dms: Migration to 19.0). All restore behaviour that was present in the 18.0 baseline and silently dropped during the port. 1. **File kanban view loses its Upload/Scan buttons.** The 18.0 `dms.KanbanButtons` template was deleted and `buttonTemplate: "dms.KanbanButtons"` was removed from `FileKanbanView`. A replacement template (`dms.FileKanbanView.Buttons`) was added in `file_kanban_controller.xml` but never wired into the view config, and the template's `t-ref` + `t-on-change` names did not match the `createFileUploadExtension()` API (`fileInput` / `onChangeFileInput` / `uploadDocument`). Fix: - Realign `dms.FileKanbanView.Buttons` to the extension's actual ref/handler names, and restore the responsive mobile-Scan + desktop-Upload pair. - Add `buttonTemplate: "dms.FileKanbanView.Buttons"` to `FileKanbanView` so the kanban toolbar actually receives the buttons. 2. **`filter_domain` silently dropped from category + tag search.** The 18.0 views explicitly set: - `dms.category` → `['|', ('name', 'ilike', self), ('parent_id', 'child_of', raw_value)]` (searching a parent category surfaces descendants — important UX for hierarchical categories like `Internal / Human Resource`). - `dms.tag` → `[('name', 'ilike', self)]` (case-insensitive contains-match; locks in semantics regardless of Odoo's evolving default field-search behaviour). The migration replaced both with bare `<field name="name" />`, changing search semantics. Restored both explicitly with a comment noting why. 3. **List-renderer xpath `.` is correct but unobvious.** Odoo 19's `web.ListView.Buttons` is a flat list of `<button>` siblings — the 18.0 `o_list_buttons` wrapper div is gone, so the prior class-scoped xpath has no anchor. Bare `.` (the implicit root) is the right answer in 19, but it reads as fragile. Added a comment block above the three `<xpath>` blocks explaining the Odoo-19-side change and why three separate one-node patches are preferable to a single multi-node patch (sibling-addon merge friendliness).
1 parent d8b9204 commit ed1b3c0

5 files changed

Lines changed: 82 additions & 18 deletions

File tree

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,56 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
2+
<!--
3+
Copyright 2020 Creu Blanca
4+
Copyright 2017-2019 MuK IT GmbH
5+
Copyright 2024 Subteno - Timothée Vannier (https://www.subteno.com).
6+
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
7+
-->
28
<templates>
9+
<!--
10+
Restores the mobile-first Scan + desktop Upload affordance that lived
11+
in the 18.0 `dms.KanbanButtons` template. The 19.0 migration deleted
12+
the prior wire-up; this template is registered as
13+
`FileKanbanView.buttonTemplate` so the toolbar still ships an upload
14+
path even when drag-and-drop is unavailable (touch devices).
15+
16+
Refs/handlers come from `createFileUploadExtension()` patched onto
17+
`KanbanController.prototype` in `file_kanban_view.esm.js`:
18+
19+
- `fileInput` — hidden <input type="file">
20+
- `uploadDocument()` — programmatically clicks the input
21+
- `onChangeFileInput()` — uploads the picked files
22+
-->
323
<t
424
t-name="dms.FileKanbanView.Buttons"
525
t-inherit="web.KanbanView.Buttons"
626
t-inherit-mode="primary"
727
>
8-
<div role="toolbar" position="inside">
9-
<input
10-
type="file"
11-
multiple="true"
12-
t-ref="uploadFileInput"
13-
class="o_input_file o_hidden"
14-
t-on-change.stop="onFileInputChange"
15-
/>
16-
<button
17-
type="button"
18-
t-attf-class="btn btn-primary o_file_kanban_upload"
19-
t-on-click.stop.prevent="() => this.uploadFileInputRef.el.click()"
20-
>
21-
Upload
22-
</button>
23-
</div>
28+
<xpath expr="//div" position="inside">
29+
<t t-if="props.archInfo.activeActions.create">
30+
<button
31+
type="button"
32+
class="d-inline d-md-none btn btn-primary mx-1"
33+
t-on-click.prevent="uploadDocument"
34+
>
35+
Scan
36+
</button>
37+
<input
38+
type="file"
39+
name="ufile"
40+
class="d-none"
41+
t-ref="fileInput"
42+
multiple="1"
43+
accept="*"
44+
t-on-change="onChangeFileInput"
45+
/>
46+
<button
47+
type="button"
48+
class="d-none d-md-inline btn btn-primary mx-1"
49+
t-on-click.prevent="uploadDocument"
50+
>
51+
Upload
52+
</button>
53+
</t>
54+
</xpath>
2455
</t>
2556
</templates>

dms/static/src/js/views/file_kanban_view.esm.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ FileKanbanRenderer.template = "dms.KanbanRenderer";
2121

2222
export const FileKanbanView = {
2323
...kanbanView,
24+
buttonTemplate: "dms.FileKanbanView.Buttons",
2425
Renderer: FileKanbanRenderer,
2526
};
2627

dms/static/src/js/views/file_list_renderer.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
2+
<!--
3+
Copyright 2020 Creu Blanca
4+
Copyright 2017-2019 MuK IT GmbH
5+
Copyright 2024 Subteno - Timothée Vannier (https://www.subteno.com).
6+
License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
7+
-->
28
<templates xml:space="preserve">
39
<t t-name="dms.ListRenderer" t-inherit="web.ListRenderer" t-inherit-mode="primary">
410
<xpath expr="//div[hasclass('o_list_renderer')]" position="before">
@@ -8,6 +14,16 @@
814
</xpath>
915
</t>
1016

17+
<!--
18+
Append our Upload/Scan/file-input siblings into Odoo 19's
19+
`web.ListView.Buttons` template. The 18.0 xpath targeted
20+
`//div[hasclass('o_list_buttons')]`; that wrapper div is gone in
21+
Odoo 19 — `web.ListView.Buttons` is now a flat list of `<button>`
22+
siblings, so `.` (the implicit root) is the only valid anchor.
23+
Three separate `<xpath>` blocks are intentional: each adds one
24+
sibling node and lets sibling addons re-order without merge
25+
conflicts on a single multi-node patch.
26+
-->
1127
<t
1228
t-name="dms.ListButtons"
1329
t-inherit="web.ListView.Buttons"

dms/views/dms_category.xml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,17 @@
1212
<field name="model">dms.category</field>
1313
<field name="arch" type="xml">
1414
<search string="Categories">
15-
<field name="name" />
15+
<!--
16+
Match either the category name itself OR any descendant
17+
category (so typing "Invoices" surfaces sub-categories
18+
nested under it). The 18.0 view set this; the 19.0
19+
migration dropped it. Restored here so search semantics
20+
stay backwards-compatible.
21+
-->
22+
<field
23+
name="name"
24+
filter_domain="['|', ('name', 'ilike', self), ('parent_id', 'child_of', raw_value)]"
25+
/>
1626
<filter
1727
string="All"
1828
name="all"

dms/views/dms_tag.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@
1212
<field name="model">dms.tag</field>
1313
<field name="arch" type="xml">
1414
<search string="Categories">
15-
<field name="name" />
15+
<!--
16+
Explicit `filter_domain` so the searchbar's default ANY
17+
autocompletion stays case-insensitive `ilike` (Odoo 19's
18+
default field-search behaviour changed; the 18.0 view
19+
locked this in). Restored from the 18.0 baseline.
20+
-->
21+
<field name="name" filter_domain="[('name', 'ilike', self)]" />
1622
<filter
1723
string="All"
1824
name="all"

0 commit comments

Comments
 (0)