Skip to content

Commit

Permalink
feat: clean version for storage (#427)
Browse files Browse the repository at this point in the history
  • Loading branch information
vrenaville authored Jun 7, 2023
1 parent d600d74 commit 9069a09
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 66 deletions.
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

0 comments on commit 9069a09

Please sign in to comment.