Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
3161 Lượt xem

Hello,

Here is the problem I am stumbling with for a couple of days. I have a tree view (a one2many field) inside a form view for which the records are created/updated/deleted depending on a field that sits inside the form view. I am using a combination of @api.onchange and falgs (1,ID), (2,ID) to modifiy the tree view content. Everything's fine except one case : I cannot delete lines in the tree view that were created from {0,0, {...}) and if the main record is not saved. The reason is that the created record gets an ID when the whole thing is saved.

I did add the ID field of the one2many records in the treeview, for newly created (and not saved records), the ID is empty. Thus I do not see a way to delete them, the command that comes out of iterating over the list of ids is (2, False), ie delete a record for which there is no Id, this does not work.
What is the way (if any) to delete records created with (0,0,{...}) and not saved to database yet ?

 

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

The newly created record(s) are in the cache, so it turns down to deleting record from the cache, their id looks like NewId ref='virtual_100'

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
4
thg 12 23
17678
1
thg 9 16
7398
0
thg 3 15
3646
0
thg 9 24
296
1
thg 3 23
2305