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

Hello,

In order to let website user edit some data, i've created an automated actions in data model with trigger "during registration".


I have this code and i don't understand why i don't have my data modified after the "write" method :

childList= env["x_list_of_child"].search([])
childs=
 childList.filtered(lambda e : e["x_studio_parent"] == 
env.user).filtered(lambda e : e["x_name"] == 
record['x_name']).filtered(lambda e : e["id"] != record['id'])
if len(childs) == 1:
    childs.write({#"x_name" :  record["x_name"],
        "x_studio_age" : record["x_studio_age"],
        "x_studio_size" : record["x_studio_size"],
        "x_studio_notes" : record["x_studio_notes"]})
    record.unlink()

The write doesn't seems to work because i have some value change when i look at childs["x_studio_age"] during the code execution but i don't see the change on data.

Any idea ?



Thanks

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

The idea to resolve this was in the first code.

Here the final code to let user write and update data with automated rules :
https://www.odoo.com/fr_FR/forum/aide-1/a-form-in-user-website-to-edit-object-in-model-257345

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 12 23
904
1
thg 6 21
2092
1
thg 3 15
5290
3
thg 7 24
1204
3
thg 3 24
4244