在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/Python  網(wǎng)絡(luò)安全/ odoo附件store_fname,并已知附件filestore地址,其他平臺(tái)如

odoo附件store_fname,并已知附件filestore地址,其他平臺(tái)如何直接獲取附件源文件

查閱資料,以及源代碼得知odoo中的附件統(tǒng)一使用ir.attachment這個(gè)模塊來(lái)存儲(chǔ),以下為ir.attachment的字段定義。datas存儲(chǔ)具體數(shù)據(jù)嗎,但在數(shù)據(jù)庫(kù)中是看不到這一字段。目前已經(jīng)拿到store_fname,并已知附件filestore地址。該如何通過外部直接獲取附件源文件(目前過程中肯定需要base64解碼)


_columns = {
    'name': fields.char('Attachment Name', required=True),
    'datas_fname': fields.char('File Name'),
    'description': fields.text('Description'),
    'res_name': fields.function(_name_get_resname, type='char', string='Resource Name', store=True),
    'res_model': fields.char('Resource Model', readonly=True, help="The database object this attachment will be attached to"),
    'res_id': fields.integer('Resource ID', readonly=True, help="The record id this is attached to"),
    'create_date': fields.datetime('Date Created', readonly=True),
    'create_uid':  fields.many2one('res.users', 'Owner', readonly=True),
    'company_id': fields.many2one('res.company', 'Company', change_default=True),
    'type': fields.selection( [ ('url','URL'), ('binary','Binary'), ],
            'Type', help="Binary File or URL", required=True, change_default=True),
    'url': fields.char('Url', size=1024),
    # al: We keep shitty field names for backward compatibility with document
    'datas': fields.function(_data_get, fnct_inv=_data_set, string='File Content', type="binary", nodrop=True),
    'store_fname': fields.char('Stored Filename'),
    'db_datas': fields.binary('Database Data'),
    'file_size': fields.integer('File Size'),
}

clipboard.png

回答
編輯回答
爛人

直接定義一個(gè)接口,使用odoo附件作為參數(shù),來(lái)下載獲取附件即可

2018年5月27日 10:48