Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: rework on attachment azure #427

Merged
merged 1 commit into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion attachment_azure/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@
# Copyright 2021 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
from . import ir_attachment
from . import ir_binary
65 changes: 0 additions & 65 deletions attachment_azure/models/ir_binary.py

This file was deleted.

26 changes: 26 additions & 0 deletions base_attachment_object_storage/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,27 @@
from . import models
from odoo.http import Stream


old_from_attachment = Stream.from_attachment


@classmethod
def from_attachment(cls, attachment):
if attachment.store_fname and attachment._is_file_from_a_store(
attachment.store_fname
):
self = cls(
mimetype=attachment.mimetype,
download_name=attachment.name,
conditional=True,
etag=attachment.checksum,
)
self.type = "data"
self.data = attachment.raw
self.last_modified = attachment["__last_update"]
self.size = len(self.data)
return self
return old_from_attachment(attachment)


Stream.from_attachment = from_attachment