Skip to content

[18.0][IMP] dms: Clean up attachments after creation of file - #470

Closed
tarteo wants to merge 1 commit into
OCA:18.0from
tarteo:18-fix-gc-attachment
Closed

[18.0][IMP] dms: Clean up attachments after creation of file#470
tarteo wants to merge 1 commit into
OCA:18.0from
tarteo:18-fix-gc-attachment

Conversation

@tarteo

@tarteo tarteo commented Mar 27, 2026

Copy link
Copy Markdown
Member

Fixes: #468

@pedrobaeza pedrobaeza added this to the 18.0 milestone Mar 27, 2026

@pedrobaeza pedrobaeza left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why an attachment is created in first place?

@tarteo

tarteo commented Apr 7, 2026

Copy link
Copy Markdown
Member Author

@pedrobaeza It reuses /web/binary/upload_attachment that creates the attachment, but functionally I don't think there's a reason.

@pedrobaeza

Copy link
Copy Markdown
Member

Then isn't better to do the upload other way for not generating that garbage?

@tarteo

tarteo commented Apr 7, 2026

Copy link
Copy Markdown
Member Author

@pedrobaeza I don't know if it's used for something, I assume there is / was a reason to use the endpoint.

@pedrobaeza

Copy link
Copy Markdown
Member

I don't think so apart from reducing the code in this part, but having that side effects, this is to be questioned. @victoralmau can you confirm?

@victoralmau

victoralmau commented Apr 9, 2026

Copy link
Copy Markdown
Member

I don't think so apart from reducing the code in this part, but having that side effects, this is to be questioned. @victoralmau can you confirm?

I see that this was added in v16 (#262), since there is already a method in the web version with similar functionality (https://github.com/odoo/odoo/blob/af32885ec5f07d492f3b8e8fff1785996a739f72/addons/web/controllers/binary.py#L217), I infer that the intention was to reduce the code a bit and use it; therefore, the change added in this PR is necessary.

@pedrobaeza

Copy link
Copy Markdown
Member

Yes, but as said, with this high side effect, I would switch again to have the complete upload handle here in this module instead of using the other, but generating the garbage. Maybe a part of the other code can be used without generating the attachment.

@victoralmau

Copy link
Copy Markdown
Member

Yes, but as said, with this high side effect, I would switch again to have the complete upload handle here in this module instead of using the other, but generating the garbage. Maybe a part of the other code can be used without generating the attachment.

Another approach: #472

victoralmau added a commit to Tecnativa/dms that referenced this pull request Apr 29, 2026
@tarteo

tarteo commented May 5, 2026

Copy link
Copy Markdown
Member Author

Yes I agree if there's no reason but reducing code we should create a handler directly in DMS that doesn't create the attachment!

victoralmau added a commit to Tecnativa/dms that referenced this pull request May 14, 2026
victoralmau added a commit to Tecnativa/dms that referenced this pull request May 14, 2026
victoralmau added a commit to Tecnativa/dms that referenced this pull request May 15, 2026
victoralmau added a commit to Tecnativa/dms that referenced this pull request May 25, 2026
@tarteo tarteo closed this May 29, 2026
dnplkndll added a commit to ledoent/dms that referenced this pull request Jun 19, 2026
Forward-port of 938f72d from 18.0 (Related to OCA#470). The upload flow
now POSTs directly to a new `/web/binary/upload_dms_file` controller that
creates the `dms.file` records, instead of round-tripping through
`upload_attachment` + `get_dms_files_from_attachments` (both removed).

19.0 adaptations on top of the forward-port:
- controller translation via `request.env._()` (not `_`).
- dropped the `dms_field` portion of the original commit (separate module, not
  part of this PR).

Co-authored-by: Víctor Martínez <victor.martinez@tecnativa.com>
dnplkndll pushed a commit to ledoent/dms that referenced this pull request Jun 19, 2026
dnplkndll pushed a commit to ledoent/dms that referenced this pull request Jun 19, 2026
dnplkndll added a commit to ledoent/dms that referenced this pull request Jun 22, 2026
Related to OCA#470 (comment)

(cherry picked from commit 938f72d)

Co-authored-by: Don Kendall <dkendall@ledoweb.com>
dnplkndll added a commit to ledoent/dms that referenced this pull request Jun 22, 2026
Related to OCA#470 (comment)

(cherry picked from commit 938f72d)

Co-authored-by: Don Kendall <dkendall@ledoweb.com>
Hotdgo9 pushed a commit to Hotdgo9/dms that referenced this pull request Jul 6, 2026
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.

[18.0] dms: attachment created during uploading of a new file is new garbage collected

3 participants