mirror of
https://github.com/camptocamp/odoo-cloud-platform.git
synced 2026-06-23 18:04:34 +00:00
BSRD-286: MIG V13 attachement_swift
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
# Copyright 2017-2018 Camptocamp SA
|
# Copyright 2017-2019 Camptocamp SA
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
|
||||||
|
|
||||||
|
|
||||||
{'name': 'Attachments on Swift storage',
|
{'name': 'Attachments on Swift storage',
|
||||||
'summary': 'Store assets and attachments on a Swift compatible object store',
|
'summary': 'Store assets and attachments on a Swift compatible object store',
|
||||||
'version': '12.0.1.0.0',
|
'version': '13.0.1.0.0',
|
||||||
'author': 'Camptocamp,Odoo Community Association (OCA)',
|
'author': 'Camptocamp,Odoo Community Association (OCA)',
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
'category': 'Knowledge Management',
|
'category': 'Knowledge Management',
|
||||||
@@ -17,5 +17,5 @@
|
|||||||
},
|
},
|
||||||
'website': 'https://www.camptocamp.com',
|
'website': 'https://www.camptocamp.com',
|
||||||
'data': [],
|
'data': [],
|
||||||
'installable': False,
|
'installable': True,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2017-2018 Camptocamp SA
|
# Copyright 2017-2019 Camptocamp SA
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
|
||||||
|
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ class IrAttachment(models.Model):
|
|||||||
|
|
||||||
def _get_stores(self):
|
def _get_stores(self):
|
||||||
l = ['swift']
|
l = ['swift']
|
||||||
l += super(IrAttachment, self)._get_stores()
|
l += super()._get_stores()
|
||||||
return l
|
return l
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
@@ -133,7 +133,7 @@ class IrAttachment(models.Model):
|
|||||||
'Error reading object from Swift object store')
|
'Error reading object from Swift object store')
|
||||||
return read
|
return read
|
||||||
else:
|
else:
|
||||||
return super(IrAttachment, self)._store_file_read(fname, bin_size)
|
return super()._store_file_read(fname, bin_size)
|
||||||
|
|
||||||
def _store_file_write(self, key, bin_data):
|
def _store_file_write(self, key, bin_data):
|
||||||
if self._storage() == 'swift':
|
if self._storage() == 'swift':
|
||||||
@@ -147,7 +147,7 @@ class IrAttachment(models.Model):
|
|||||||
_logger.exception('Error writing to Swift object store')
|
_logger.exception('Error writing to Swift object store')
|
||||||
raise exceptions.UserError(_('Error writing to Swift'))
|
raise exceptions.UserError(_('Error writing to Swift'))
|
||||||
else:
|
else:
|
||||||
_super = super(IrAttachment, self)
|
_super = super()
|
||||||
filename = _super._store_file_write(key, bin_data)
|
filename = _super._store_file_write(key, bin_data)
|
||||||
return filename
|
return filename
|
||||||
|
|
||||||
@@ -168,4 +168,4 @@ class IrAttachment(models.Model):
|
|||||||
# we ignore the error, file will stay on the object
|
# we ignore the error, file will stay on the object
|
||||||
# storage but won't disrupt the process
|
# storage but won't disrupt the process
|
||||||
else:
|
else:
|
||||||
super(IrAttachment, self)._file_delete_from_store(fname)
|
super()._file_delete_from_store(fname)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2017-2018 Camptocamp SA
|
# Copyright 2017-2019 Camptocamp SA
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2017-2018 Camptocamp SA
|
# Copyright 2017-2019 Camptocamp SA
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
@@ -17,7 +17,7 @@ from odoo.addons.attachment_swift.swift_uri import SwiftUri
|
|||||||
class TestAttachmentSwift(TestIrAttachment):
|
class TestAttachmentSwift(TestIrAttachment):
|
||||||
|
|
||||||
def setup(self):
|
def setup(self):
|
||||||
super(TestAttachmentSwift, self).setUp()
|
super().setUp()
|
||||||
self.env['ir.config_parameter'].set_param('ir_attachment.location',
|
self.env['ir.config_parameter'].set_param('ir_attachment.location',
|
||||||
'swift')
|
'swift')
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright 2017-2018 Camptocamp SA
|
# Copyright 2017-2019 Camptocamp SA
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
|
||||||
|
|
||||||
from odoo.addons.base.tests.test_ir_attachment import TestIrAttachment
|
from odoo.addons.base.tests.test_ir_attachment import TestIrAttachment
|
||||||
@@ -12,7 +12,7 @@ class TestAttachmentSwift(TestIrAttachment):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def setup(self):
|
def setup(self):
|
||||||
super(TestAttachmentSwift, self).setUp()
|
super().setUp()
|
||||||
self.env['ir.config_parameter'].set_param('ir_attachment.location',
|
self.env['ir.config_parameter'].set_param('ir_attachment.location',
|
||||||
'swift')
|
'swift')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user