Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
8432 Представления

When submitting the form containing an input of type "file"

/

t-attf-class="form-control 
o_website_form_input
#{error.get('attachment_ids') and 'is-invalid' or ''} "
id="attachment_ids"
name="attachment_ids" t-att-value="attachment_ids"
multiple="true"/>

this line in controller causes the error:

'attachment_ids': base64.encodestring(kw.get("attachment_ids").read()),

the controller's method is the one belongs to website_sale module:

@http.route(['/shop/address'], type='http', methods=['GET', 'POST'], auth="public", website=True, sitemap=False)
def address(self, **kw):


and this is the definition of the field attachment_ids in the model:

attachment_ids = fields.Many2many('ir.attachment', string='Files', required=True)

can any one help me please, i've been searching for solution for a long time and got nothing until now



Аватар
Отменить
Лучший ответ

Try by adding these attributes in the form 

enctype="multipart/form-data"
method="post"

the way of assignment is wrong, Many2many do not take values like check the source code for example.

'attachment_ids': base64.encodestring(kw.get("attachment_ids").read())
Аватар
Отменить
Related Posts Ответы Просмотры Активность
0
сент. 22
803
3
сент. 21
5095
1
апр. 21
5746
1
янв. 19
4482