-
- Downloads
[FIX] base: attachment copy ACL
Currently, `Attachment.copy` has an *explicit* check for write access on the underlying record. This doesn't necessarily make sense e.g. a user copying an attachment from a template to an email may not have write access to the template, but that should not be an issue. And indeed if the copy is performed "by hand" (read then create) things work fine[^1]. Since both `read` and `create` are checked, the explicit `copy` check doesn't seem necessary. Drop it, and try to add some tests around `copy`. Move `test_06_linked_record_permission` to its own `TestCase` and split it for readability. A secondary issue is that the `check` in `create` was performed in the context of the `self` being copied, leading to the same issue as `copy` being repeated (that is, `a.copy()` would call `a.create()` which would call `a.check('write')`, even though we're semantically creating a record from scratch). The behavior is really intended for `write` where we want to check if we have `write` access to both the "source" and the "destination" records. Explicitly opt-out of having any source data in the `create` before performing the `check` calls, this way we correctly and only check for the writability of the destination, and only check for the readability of the source. issue 2746483 [^1] well not entirely true, see 4th paragraph closes odoo/odoo#84580 X-original-commit: bb956d7d Signed-off-by:Raphael Collet <rco@odoo.com> Signed-off-by:
Xavier Morel (xmo) <xmo@odoo.com>
Loading
Please register or sign in to comment