According to this answer: what does attachment=True do odoo 13
When you do self.env[\'ir.attachment\'].search([]) you do not get the records whose
self.env[\'ir.attachment\'].search([])