Odoo 11 store attachments to other db

元气小坏坏 提交于 2019-12-13 02:56:58

问题


In Odoo 11 I want to store the attachment in a different database. So to achieve that I need to get the file once uploaded. So for that I have made my code like this

import logging
from odoo import fields
from odoo import models,api
import base64

_logger = logging.getLogger(__name__)

class AttachmentStorage(models.Model):

    _name = "attachment.storage"
    _inherit = 'ir.attachment'

    @api.model
    def _file_write(self, value, checksum):
        bin_value = base64.b64decode(value)
        printf(bin_value)
        fname, full_path = self._get_path(bin_value, checksum)
        printf(full_path)

But here when I am updating or adding any profile image of an employee(as I am using hr module) this doesn't showing any thing even I am doing printf.

So can someone tell me how to achieve this? I want to store all the attachments in the different db.

NOTE: I have installed Odoo using docker on my local system

来源:https://stackoverflow.com/questions/56544393/odoo-11-store-attachments-to-other-db

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!