Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
3981 Lượt xem


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?

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

I did it in write method

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất
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')
Ảnh đại diện
Huỷ bỏ


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

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

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 12 24
1331
1
thg 3 23
6525
0
thg 10 21
2551
2
thg 5 20
12122
2
thg 12 17
4213