[IMP] Cache bundles in ir.attachments instead of a LRU

Forward ported from 8.0's commit: 8402625
[FIX] mail: bad test
[IMP] hr: strenghtening of write()
[IMP]: added new fields (amount_total, amount_invoiced and remaining amount) while creating partial invoice based on sale order