I need to create some object which able to have many attachments.
As the figure shows, The object has two medical attachment entitled first and second. The files are uploaded too which names are tes.csv and tes2.csv
When I check them to Knowledge->Documents->Documents Menu, files were uploaded successfully as you can see here.
But, the problem is, when I click to download the attachment files, for example tes.csv file from one2many tree, the browser will get .bin files not .csv files.
This makes me frustrated, because of when I tried to download them from Knowledge->Documents->Documents Menu, the browser gets .csv files successfully.
You can see the difference of two methods when I'm hovering my mouse to these two form view.
1. My Module->Form View->One2Many Field
data:application/octet-stream
2. Knowledge->Documents->Documents Menu->Form View->File Content Field
javascript:void(0)
When I trace them, the First Method won't call ir_attachment._file_read method. And the second Method will call ir_attachment._file_read method for sure.
Please help me, so my new one2many field module attachment can download the files with their extension not just a BIN.FILE.
Thank you
Edited :
This one is .py
_name = 'hr.medreq'
_columns = {
'name':fields.char('Name'),
'attach_ids':fields.one2many('ir.attachment', 'medreq_id', 'Medical Attachment'),
'attachment_ids': fields.many2many('ir.attachment', 'class_ir_attachments_rel', 'class_id', 'attachment_id', 'Attachments'),
}
This one is .xml
<tree string="Medical Attachment">
<field name="name"/>
<field name="type" invisible="1"/>
<field name="store_fname" invisible="1"/>
<field name="datas" filename="datas_fname"/>
<field name="datas_fname" invisible="1" modifiers="{'invisible': true}"/>
</tree>
Thanks!