Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
2 Vastaukset
3977 Näkymät


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
Hylkää
Tekijä Paras vastaus

I did it in write method

Avatar
Hylkää
Paras vastaus
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
Hylkää


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

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

Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
0
jouluk. 24
1329
1
maalisk. 23
6525
0
lokak. 21
2551
2
toukok. 20
12120
2
jouluk. 17
4212