问题
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
回答1:
You are not doing something wrong, ir.attachment records are hidden when the value of res_field (a Char field) is set.
When you upload the file and save, an attachment is created and the value of the res_field is set to record_file which makes it invisible under Attachments.
You can check that the methods _search and read_group was overridden to add res_field=False in the domain if not present.
Note that the default value for the attachment parameter is True so you do not need to useattachment=True.
来源:https://stackoverflow.com/questions/62905093/what-does-attachment-true-do-odoo-13