跳至內容
選單
此問題已被標幟
1 回覆
2607 瀏覽次數

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
2354
1
2月 18
3443
0
11月 19
3281
6
8月 18
10474
3
12月 17
3727