fix ir.attachment permission checking

Current model for permission checking on ir.attachment checks the requested operation on the target model. That is, to remove an attachment from a sale.order, you need to be able to remove sale orders.

This branch makes the checking be done first on ir.attachment directly, and then checks for write access to the target model, as changing attachments can be seen as an update to the target.