Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
3546 Widoki


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?

Awatar
Odrzuć
Autor Najlepsza odpowiedź

I did it in write method

Awatar
Odrzuć
Najlepsza odpowiedź
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')
Awatar
Odrzuć


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

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

Powiązane posty Odpowiedzi Widoki Czynność
0
gru 24
914
1
mar 23
6055
0
paź 21
2309
2
maj 20
11748
2
gru 17
3888