Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
27719 มุมมอง

Hi, I want to know how can I choose many file in my PC to my application, like the field binary but I don't want one file, I would like to add many file. Thank you for answer...

อวตาร
ละทิ้ง

I think we can't save multiple file in single field. So use 2 classes with one2many relation. In child class we add binary field for multiple file should be chosen.

คำตอบที่ดีที่สุด

You can see it on message module:

<field name="attachment_ids" widget="many2many_binary"/>

You can find it here: /mail/wizard/mail_compose_message_view.xml

It handles that with qweb, but it's a little bit complex.

Anyways you can look this as an example to do this.

อวตาร
ละทิ้ง
ผู้เขียน

Ok thanks Grover, it's run

Did you made it run? Awesome, i'll try later

ผู้เขียน คำตอบที่ดีที่สุด

I put this inmy class.py 'attachment_ids': fields.many2many('ir.attachment', 'class_ir_attachments_rel', 'class_id', 'attachment_id', 'Attachments'), and this in my class_view.xml <field name="attachment_ids" widget="many2many_binary"/>

อวตาร
ละทิ้ง

Thank you @ Malle.

+1

Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ก.ค. 18
4548
Read content of Binary fields แก้ไขแล้ว
6
ธ.ค. 23
17874
1
มิ.ย. 23
3292
Binary field as attachment in mail แก้ไขแล้ว
5
ม.ค. 23
16504
2
ก.พ. 20
14826