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

I created a custom module in which I have this field

record_file = fields.Binary(string='file', attachment=True, help='Upload the file')

from what I understand `attachment=True` should save my images or pdfs to ir.attachment but am not seeing any there 

am I doing something wrong


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

If helps the attachment associated with the field is searched using the following domain(example using the field record_file):

domain = [
('res_model', '=', model._name),
('res_field', '=', 'record_file'),
('res_id', 'in', record.id),
]
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Attachments can be configured to be stored either in the database or in the filestore. You can check this by going to Settings > Technical > System Parameters (under Parameters) and looking at the value set for the parameter ir_attachment.location

If you go through the Odoo UI (Settings > Technical > Attachments (under Database Structure)) you should be able to see the attachment no matter where it is is stored. If you are going directly against the database, you will see it in there only if the system is configured to store attachments in the database.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
2
thg 12 24
4565
1
thg 11 24
3385
2
thg 4 23
18467
1
thg 3 23
2580
4
thg 8 24
24547