mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
[MIG] attachment_minio: odoo 13, additionally include mime-type per GITHUB#12
This commit is contained in:
@@ -50,3 +50,11 @@ env.cr.commit()
|
|||||||
|
|
||||||
If `attachment_minio` is not already installed, you can then install it and the migration
|
If `attachment_minio` is not already installed, you can then install it and the migration
|
||||||
should be noted in the logs. **Ensure that the timeouts are long enough that the migration can finish.**
|
should be noted in the logs. **Ensure that the timeouts are long enough that the migration can finish.**
|
||||||
|
|
||||||
|
### Base Setup
|
||||||
|
|
||||||
|
This module utilizes `base_attachment_object_storage`
|
||||||
|
|
||||||
|
The System Parameter `ir_attachment.storage.force.database` can be customized to
|
||||||
|
force storage of files in the database. See the documentation of the module
|
||||||
|
`base_attachment_object_storage`.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "Attachment MinIO",
|
"name": "Attachment MinIO",
|
||||||
"version": "12.0.1.0.0",
|
"version": "13.0.1.0.0",
|
||||||
"depends": [
|
"depends": [
|
||||||
"base_attachment_object_storage",
|
"base_attachment_object_storage",
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -85,7 +85,9 @@ class MinioAttachment(models.Model):
|
|||||||
client = self._get_minio_client()
|
client = self._get_minio_client()
|
||||||
bucket = self._get_minio_bucket(client)
|
bucket = self._get_minio_bucket(client)
|
||||||
minio_key = self._get_minio_key(key)
|
minio_key = self._get_minio_key(key)
|
||||||
client.put_object(bucket, minio_key, io.BytesIO(bin_data), len(bin_data))
|
with io.BytesIO(bin_data) as bin_data_io:
|
||||||
|
client.put_object(bucket, minio_key, bin_data_io, len(bin_data),
|
||||||
|
content_type=self.mimetype)
|
||||||
return self._get_minio_fname(bucket, minio_key)
|
return self._get_minio_fname(bucket, minio_key)
|
||||||
return super(MinioAttachment, self)._store_file_write(key, bin_data)
|
return super(MinioAttachment, self)._store_file_write(key, bin_data)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user