Invoices and Creditnotes ::initializeWithRawData, minor fixes and refactors