跳至內容
選單
此問題已被標幟
2 回覆
3574 瀏覽次數


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?

頭像
捨棄
作者 最佳答案

I did it in write method

頭像
捨棄
最佳答案
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')
頭像
捨棄


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

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

相關帖文 回覆 瀏覽次數 活動
0
12月 24
930
1
3月 23
6085
0
10月 21
2323
2
5月 20
11766
2
12月 17
3904