Performance improvement: defer optional write() - there's another one coming later, values can be combined.
Remove unused imports/variables
Remark from MAT: invoice date wasn't passed on in original code after the original optional write.
Merge pull request #751 from jrial/master

[FIX] account: Small performance fix + cleanup of account_invoice

Remove unused imports and variables
Merge two writes into one
Make sure we use the newly invoice_date and not the one left in the cache of the browse record