Skip to content

Commit

Permalink
feat: clean version for storage
Browse files Browse the repository at this point in the history
  • Loading branch information
vrenaville committed Jun 7, 2023
1 parent d600d74 commit f14bdc4
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 66 deletions.
2 changes: 1 addition & 1 deletion attachment_azure/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# 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.

24 changes: 24 additions & 0 deletions base_attachment_object_storage/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,25 @@
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 f14bdc4

Please sign in to comment.