コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
5270 ビュー

Hi everyone,

I created a custom form and I able to save fields like email, name, etc. Now I want to attach image to the form. These are my files

Model:

from odoo import models, fields, api, _
from odoo.modules.module import get_module_resource
import base64

class Registro(models.Model):
    _name = 'feria.registro'
    _description = 'Recopilacion de datos en Feria'
    name = fields.Char(string='Name', required=True, tracking=True)
    attachment = fields.Image('Image', attachment=True)......


Controller:

class Feria(http.Controller):
    @http.route('/feria/formulario', type="http", auth='public', website=True)
    def feria_form(self, **kw):
    contact_list = request.env['res.partner'].sudo().search([])
    values = {
        'attachment': attachment_id
    }
    return http.request.render('feria.custom_form', value)


View:


With this, I´m getting the error:

TypeError: 'FileStorage' object is not subscriptable


Please help me, I´m learning Odoo :)


アバター
破棄
関連投稿 返信 ビュー 活動
2
2月 24
5010
1
9月 22
2474
2
5月 22
14940
2
7月 24
4028
2
5月 25
9651