콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
5116 화면

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
4801
1
9월 22
2390
2
5월 22
14784
2
7월 24
3869
2
5월 25
9489