Skip to content

[20.0][MIG] dms: Migration to 20.0 - #532

Open
CarlosRoca13 wants to merge 100 commits into
OCA:20.0from
Tecnativa:20.0-MIG-dms
Open

CarlosRoca13 wants to merge 100 commits into
OCA:20.0from
Tecnativa:20.0-MIG-dms

Conversation

@CarlosRoca13

Copy link
Copy Markdown

@pedrobaeza

Copy link
Copy Markdown
Member

/ocabot migration dms

@OCA-git-bot OCA-git-bot added this to the 20.0 milestone Oct 28, 2026
@OCA-git-bot OCA-git-bot mentioned this pull request Oct 28, 2026
4 tasks
victoralmau and others added 24 commits October 29, 2026 08:52
(cherry picked from commit 99f2a9a)
…field - Remove path_names field - Remove FieldPathNames (related to path_names)

(cherry picked from commit d1dac0d)
(cherry picked from commit a4212a1)
… All text to Root) + Change to searchpanel directory_id (in files) or parent_id (in directories) to filter equal and not child_of

(cherry picked from commit ddef636)
We need to overwrite function from directories because odoo only return
records with childs (very weird for user perspective).
All records are returned now.

(cherry picked from commit eea9b6b)
…search panel directory).

TT41585

(cherry picked from commit e029027)
…ich you have access) in the portal view.

TT41585

(cherry picked from commit 8282362)
The method _compute_image_1920 of dms_file checks if the file is of
mimetype image and tries to use it as a thumbnail.
However, there are several types of image files that Odoo/PIL
cannot work with, leading to the following error:

```
Traceback (most recent call last):
  File "/opt/odoo/custom/src/odoo/odoo/tools/image.py", line 404, in base64_to_image
    return Image.open(io.BytesIO(base64.b64decode(base64_source)))
  File "/usr/local/lib/python3.6/site-packages/PIL/Image.py", line 2687, in open
    % (filename if filename else fp))
OSError: cannot identify image file <_io.BytesIO object at 0x7f0a6ecb1780>
```

and also further down

```
odoo.exceptions.UserError: ('This file could not be decoded as an image file. Please try with a different file.', '')
```

Examples of such files are CAD files (mimetype: image/vnd.dwg)
For a list of all mimetypes starting with "image/" see:
https://www.iana.org/assignments/media-types/media-types.xhtml#image

(cherry picked from commit fdfe5d9)
Change in the permissions for DMS Access Groups:

- Not every user can create new access groups, but only dms_users.
- DMS managers (not admin users) can manage every access group
- Add tests

After this change:

- the base user has read only access
- the group_dms_user can create, and can write and unlink their own groups
- the group_dms_manager can do everything on every group.

(cherry picked from commit a659369)
… the files.

TT43563

(cherry picked from commit 3ebd09e)
Currently translated at 94.3% (319 of 338 strings)

Translation: dms-15.0/dms-15.0-dms
Translate-URL: https://translation.odoo-community.org/projects/dms-15-0/dms-15-0-dms/es/
(cherry picked from commit 010edfd)
(cherry picked from commit 7da2368)
Translated using Weblate (Portuguese (Brazil))

Currently translated at 70.0% (238 of 340 strings)

Translation: dms-16.0/dms-16.0-dms
Translate-URL: https://translation.odoo-community.org/projects/dms-16-0/dms-16-0-dms/pt_BR/

Translated using Weblate (Portuguese (Brazil))

Currently translated at 75.5% (257 of 340 strings)

Translation: dms-16.0/dms-16.0-dms
Translate-URL: https://translation.odoo-community.org/projects/dms-16-0/dms-16-0-dms/pt_BR/
(cherry picked from commit f5971bd)
eLBati and others added 25 commits October 29, 2026 08:52
Currently translated at 100.0% (354 of 354 strings)

Translation: dms-18.0/dms-18.0-dms
Translate-URL: https://translation.odoo-community.org/projects/dms-18-0/dms-18-0-dms/it/
(cherry picked from commit b82c5ad)
Currently translated at 100.0% (359 of 359 strings)

Translation: dms-18.0/dms-18.0-dms
Translate-URL: https://translation.odoo-community.org/projects/dms-18-0/dms-18-0-dms/it/
(cherry picked from commit 547eaaf)
… is applied correctly.

Before these changes, the domain was never applied to search by the parent, so all subfolders were being displayed instead of only the direct children of the selected one.

After making the changes, only a single level of folders is shown, without displaying all descendant folders.

(cherry picked from commit 12c54a9)
Currently translated at 89.6% (322 of 359 strings)

Translation: dms-18.0/dms-18.0-dms
Translate-URL: https://translation.odoo-community.org/projects/dms-18-0/dms-18-0-dms/es/
(cherry picked from commit 687ec9c)
The _check_access_dms_record method uses self.search(domain) to verify
write permissions. However, search() applies active_test=True by default,
which excludes archived records (active=False).

This means when a user tries to unarchive a file via toggle_active(),
the write permission check cannot find the archived record in the search
results, causing an AccessError even when the user has full write
permissions through DMS access groups.

Fix: add active_test=False context to include archived records in the
permission check search.

(cherry picked from commit 86cc746)
Currently translated at 99.7% (358 of 359 strings)

Translation: dms-18.0/dms-18.0-dms
Translate-URL: https://translation.odoo-community.org/projects/dms-18-0/dms-18-0-dms/es/
(cherry picked from commit 69f82dc)
Currently translated at 100.0% (358 of 358 strings)

Translation: dms-18.0/dms-18.0-dms
Translate-URL: https://translation.odoo-community.org/projects/dms-18-0/dms-18-0-dms/it/
(cherry picked from commit b5c4821)
When an incoming email is processed for a dms.directory alias configured
with "Unpack Emails as: Subdirectory" (alias_process='directory'),
message_new() builds the new subdirectory name from the email subject by
calling ir.http._slug() on a plain string. _slug() expects a record or a
(id, name) tuple, so it raises:

    ValueError: too many values to unpack (expected 2)

and the incoming email cannot be ingested. The intent is simply to
slugify the subject string, which is what ir.http._slugify() does.
Use it instead.
Previous implementation was failing to convert strings to base64, which
is the case when we receive plain HTML encoded as base64; as shown in
mail02.eml.

This in turn lead to inconsistencies when saving/reading these contents
afterwards, as the rest of the code always assumes dms.file::content
contains base64 data.

This was falling through cracks because although the resulting data is
invalid base64, the b64decode impl in python 3.12/3.13 is lax enough it
would ignore failures in this case because our test string is
"base64-ish" enough.

However, when running Odoo on Debian with the patch
https://sources.debian.org/patches/python3.13/3.13.5-2+deb13u3/CVE-2026-3446.patch/
applied, this test on mail02.eml produced errors in
dms.file::_inverse_content when trying to b64decode:

> <class 'binascii.Error'> Invalid base64-encoded string: number of data characters (429) cannot be 1 more than a multiple of 4
dms.file.check_access_token compared the directory walker against
self.directory_id instead of against the directory owning the token, so
both the loop test and the "fix last level" test were self-comparisons
that are always true. The branch collapsed to `return True` whenever any
directory carried the supplied token, granting read access to every
dms.file in the database regardless of directory or group inheritance.

Compare against item.id, matching the correct implementation in
dms.directory.check_access_token, and sudo the walk so ancestors the
caller cannot read are still traversable.

_get_files in the portal controller relied on the always-true behaviour:
it called check_access_token on an empty dms.file recordset, where
False == False happened to authorise the shared listing. Validate the
token against the directory being browsed instead, mirroring the pattern
already used by _get_directories.

Adds regression tests covering unrelated trees, root-level files,
descendant directories and a file's own token.

Assisted-by: Claude Opus 5

[FIX] dms: bound the share-token ancestor walk

The file-side walk previously returned on its first iteration because of
the self-comparison bug, so it never actually traversed. Now that it
does, a parent cycle would spin forever in a request reachable without
authentication. _check_directory_recursion rejects cycles created
through the ORM, so this only bites on corrupted data or direct SQL, but
an unbounded loop on an anonymous endpoint is not worth leaving open.

Track visited ids in both dms.file and dms.directory rather than
imposing an arbitrary depth limit, so legitimate deep trees are
unaffected.

Assisted-by: Claude Opus 5

Co-authored-by: sajjad <sajjad@millow.co>
Assisted-by: Claude Fable 5
Assisted-by: Claude Fable 5
OR([[], ('name', 'ilike', search) leaf]) contains the empty domain, which
normalizes to TRUE — the absorbing element of OR — so the search term was
discarded: 18.0 expression.combine returns its zero, 19.0 Domain.OR
optimizes to [(1, '=', 1)]. Verified live in both forms; a search for a
non-existent term returned every directory.

The empty seed came from the core portal multi-field accumulator idiom
(38d8463, 2020), where core appends per-field domains to a plain list and
ORs once at the end; inlined to the current shape by the 17.0 migration.

Assisted-by: Claude Fable 5
Use Case Example:
- Create an archived user (an employee’s user account that will be activated in the future)
- Create a group that explicitly includes the user created earlier (this is done indirectly using `hr_dms_field`)
- The `users` field does not contain this user

TT64366
Use node content instead of a t-value expression so the portal
description is correctly extracted for translation.
Currently translated at 100.0% (341 of 341 strings)

Translation: dms-19.0/dms-19.0-dms
Translate-URL: https://translation.odoo-community.org/projects/dms-19-0/dms-19-0-dms/it/
@oca-cla-bot

oca-cla-bot Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.