Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
2 Besvarelser
3958 Visninger


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
Kassér
Forfatter Bedste svar

I did it in write method

Avatar
Kassér
Bedste svar
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
Kassér


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

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

Related Posts Besvarelser Visninger Aktivitet
0
dec. 24
1326
1
mar. 23
6517
0
okt. 21
2550
2
maj 20
12115
2
dec. 17
4201