You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

31 lines
982 B

# @ 2016 Florian DA COSTA @ Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import models, fields, api
import os
class AttachmentQueue(models.Model):
_inherit = 'attachment.queue'
task_id = fields.Many2one('attachment.synchronize.task', string='Task')
storage_backend_id = fields.Many2one(
'storage.backend', string='Storage Backend',
related='task_id.backend_id', store=True)
file_type = fields.Selection(
selection_add=[
('export',
'Export File (External location)')
])
def _run(self):
super()._run()
if self.file_type == 'export':
path = os.path.join(self.task_id.filepath, self.datas_fname)
self.storage_backend_id._add_b64_data(path, self.datas)
def _get_failure_emails(self):
res = super()._get_failure_emails()
if self.task_id.emails:
res = self.task_id.emails
return res