Not sure, but it seems that $this and Invoice::model()->findByPk($this->id) are not returning the same class. Try to use a print_r() function to check it.
Anyway, why put saveInDiary in the Invoice model? You should not put a business-control inside a model. This method should reside in the Controller, I think.
The related objects are only fetched once. So if you access $invoice->total and change the related data later, total will not get updated until you fetch a fresh $invoice.
Because otherwhise there would be another query, whenever you access a related property - not what most users want. Not sure if refresh() might clean the fetched related records again. Maybe give that a try?