mirror of
https://github.com/camptocamp/odoo-cloud-platform.git
synced 2026-06-24 02:08:36 +00:00
Storage should be 's3'
This commit is contained in:
@@ -114,7 +114,7 @@ class IrAttachment(models.Model):
|
|||||||
@api.model
|
@api.model
|
||||||
def _file_read(self, fname, bin_size=False):
|
def _file_read(self, fname, bin_size=False):
|
||||||
storage = self._storage()
|
storage = self._storage()
|
||||||
if storage.startswith('s3') or fname.startswith('s3://'):
|
if storage == 's3' or fname.startswith('s3://'):
|
||||||
read = self._file_read_s3(fname, bin_size=bin_size)
|
read = self._file_read_s3(fname, bin_size=bin_size)
|
||||||
if not read and not fname.startswith('s3://'):
|
if not read and not fname.startswith('s3://'):
|
||||||
# If the attachment has been created before the installation
|
# If the attachment has been created before the installation
|
||||||
@@ -134,7 +134,7 @@ class IrAttachment(models.Model):
|
|||||||
@api.model
|
@api.model
|
||||||
def _file_write(self, value, checksum):
|
def _file_write(self, value, checksum):
|
||||||
storage = self._storage()
|
storage = self._storage()
|
||||||
if storage.startswith('s3'):
|
if storage == 's3':
|
||||||
bucket = self._get_s3_bucket()
|
bucket = self._get_s3_bucket()
|
||||||
bin_data = value.decode('base64')
|
bin_data = value.decode('base64')
|
||||||
key = self._compute_checksum(bin_data)
|
key = self._compute_checksum(bin_data)
|
||||||
@@ -193,7 +193,7 @@ class IrAttachment(models.Model):
|
|||||||
)
|
)
|
||||||
|
|
||||||
storage = self._storage()
|
storage = self._storage()
|
||||||
if not storage.startswith('s3'):
|
if storage != 's3':
|
||||||
return
|
return
|
||||||
_logger.info('migrating files to the object storage')
|
_logger.info('migrating files to the object storage')
|
||||||
domain = ['!', ('store_fname', '=like', 's3://%'),
|
domain = ['!', ('store_fname', '=like', 's3://%'),
|
||||||
@@ -269,7 +269,7 @@ class IrAttachment(models.Model):
|
|||||||
@api.model
|
@api.model
|
||||||
def force_storage(self):
|
def force_storage(self):
|
||||||
storage = self._storage()
|
storage = self._storage()
|
||||||
if storage.startswith('s3'):
|
if storage == 's3':
|
||||||
self._force_storage_s3()
|
self._force_storage_s3()
|
||||||
else:
|
else:
|
||||||
return super(IrAttachment, self).force_storage()
|
return super(IrAttachment, self).force_storage()
|
||||||
|
|||||||
Reference in New Issue
Block a user