Skip to content

Commit 6d04b10

Browse files
committed
Merge PR OCA#3011 into 16.0
Signed-off-by bguillot
2 parents db9e502 + bf53ff5 commit 6d04b10

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

attachment_synchronize/models/attachment_queue.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ class AttachmentQueue(models.Model):
2121
selection_add=[("export", "Export File (External location)")]
2222
)
2323

24+
def _write_file_to_remote(self, fs, full_path):
25+
self.ensure_one()
26+
data = base64.b64decode(self.datas)
27+
with fs.open(full_path, "wb") as f:
28+
f.write(data)
29+
2430
def _run(self):
2531
res = super()._run()
2632
if self.file_type == "export":
@@ -32,9 +38,7 @@ def _run(self):
3238
# create missing folders if necessary :
3339
if folder_path and not fs.exists(folder_path):
3440
fs.makedirs(folder_path)
35-
data = base64.b64decode(self.datas)
36-
with fs.open(full_path, "wb") as f:
37-
f.write(data)
41+
self._write_file_to_remote(fs, full_path)
3842
return res
3943

4044
def _get_failure_emails(self):

0 commit comments

Comments
 (0)