Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
17708 Lượt xem

In tree view or one2many lines, I have a binary field that has an attribute of widget="binary".

However, when I download from the tree view it the file name becomes 'my.model-1-my_field.pdf' and not the original file name.

<field name="my_field" widget="binary"/>
Ảnh đại diện
Huỷ bỏ

Hi, there,

The above answer is available and there is another solution, which allows you to upload more than one file one time.

Try this(for example):

Step1( add in the py file):

field_name = fields.Many2many(comodel_name = "ir.attachment", relation = "m2m_ir_attachment_relation", column1 = "m2m_id", column2 = "attachment_id", string = "Attachments", )

Step2(add in the XML file):


Hope it is useful.

Tác giả Câu trả lời hay nhất

This is now possible in Odoo 14.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

You have to add a char field 'filename' to your model and add "filename" attribute to your view.


See code below:

<field name="document" filename="document_fname" widget="binary"/>
<field name="document_fname" invisible="1"/>
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 2 23
9167
0
thg 7 16
4481
1
thg 4 23
1924
1
thg 1 18
5789
1
thg 12 22
5714