I have a model Model_Panier (=cart) having manies rows (Model_Panier_Contenu), and I would like to cascade the saves of rows into the cart, so that the total amount and other fields are calculated (using an observer attached to the before_save event).
My observer is working good, but it is like the the cascade_save does nothing... here is my field declaration :
So, if I want to implement a kind of cascade_save from child to parent, essentially for calculated fields and updated_at value, I imagine that an observer is the right way ..?
Easier would be to always save the parent. That will trigger any observer on that parent, which could loop over the children and add totals and other stuff), and it will by default cascase_save all children.
We have a similar setup in our finance module (which has Invoice and Invoicelines models) where the save of the invoice record triggers calculation of VAT on every invoice line, and of the total amount incl. and excl. VAT of the invoice which is stored in the invoice record.