This question has been flagged
1 Reply
1916 Views

Is possible to get the ids of the related children that were changed in a editable list view in a form? In the context there is only the ID of the parent. I need to do some calculations on the changed child record when it's changed. So I run a "refresh" method on the child when I save the parent record. This becomes slower and slower the more child records it has because it "refreshes every record".  

The fields in the child model are combined and changing one can trigger a compute method for another field in the model. So calling the "refresh" method in the child write method is A NO GO, every computed field calls the write method when it sets a value to a field (self.field = value) so it goes into an infinite recursion.   

If there was a way to get ids of changed childs I could just use a for loop that checks if child.id in list of child ids and only then call the "refresh" method.  


Avatar
Discard
Author Best Answer

It's not possible. When there is a relational list in the form view, it runs the method on every record in the list. The methods in the model that is in the list need to have the api.multi decorator. 

Avatar
Discard