Skip to Content
Menú
This question has been flagged
2 Respostes
3533 Vistes


I have binary field with attachment=true. All those files have been saved with name of binary field. I want that those files will be automatically save with the same name as res_name. How to do that?

Avatar
Descartar
Autor Best Answer

I did it in write method

Avatar
Descartar
Best Answer
You can achieve it by doing the following:

attachment_id = fields.Many2one('ir.attachment', string='Attachment')

attachment_fname = fields.Char('Attachment Filename', related='attachment_id.name')
Avatar
Descartar


<field name="attachment_fname" invisible="1"/>

<field name="attachment_id" filename="attachment_fname"/>

Related Posts Respostes Vistes Activitat
0
de des. 24
912
1
de març 23
6045
0
d’oct. 21
2304
2
de maig 20
11742
2
de des. 17
3878