In my custom module, I added the chatter system so I can upload multiple attachments at once since the smart button that I added relating to 'ir.attachment' model only creates a record with one pdf at a time. When uploading a pdf using the ir.attachment form, I was able to check if a pdf has already been uploaded by comparing the name and modification date. So, if my code in ir.attachment model detects that it's an older file, it will raise an error but overwrites it if a more recent file and retrieves the information inside the pdf file and creates a one2many line in my custom module every time I upload. The problem now is that in attachments of the chatter I can re-upload a file with the same name and it even saves it with the same name, and I have no way yet to traverse each files and read it one by one so I can run my code from there.
What I am aiming to do is:
1. Only allow pdf to be uploaded in chatter's attachments.
2. Overwrite the existing pdf file if the new pdf file has a more recent modification date3. Traverse each file during upload.
4. Run a python code during the uploading of file(s) since I need to convert the content of the pdf file to a one2many line inside my custom module.