[IMP]: Allow to pass storage as a context key

This commit is contained in:
Akim Juillerat
2019-03-11 15:39:53 +01:00
parent c61cf6c4e5
commit 498aae2f53
2 changed files with 10 additions and 7 deletions
+2 -1
View File
@@ -131,7 +131,8 @@ class IrAttachment(models.Model):
@api.model
def _store_file_write(self, key, bin_data):
if self._storage() == 's3':
location = self.env.context.get('storage_location') or self._storage()
if location == 's3':
bucket = self._get_s3_bucket()
obj = bucket.Object(key=key)
file = io.BytesIO()