跳至内容
菜单
此问题已终结
1 回复
2754 查看

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.  


形象
丢弃
编写者 最佳答案

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. 

形象
丢弃
相关帖文 回复 查看 活动
1
4月 19
2592
1
2月 18
3708
0
11月 19
3538
6
8月 18
10811
3
12月 17
4018