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

When I try to update a field before raising a UserError, the value doesn't get saved to the database. How can I ensure the field is saved even before the UserError is raised?

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

We can use 

self.env.cr.commit()

just before the UserError() to save the values.

Eg:

self.env.cr.commit()
raise UserError('Some issue has been occured')
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 12 18
5462
0
thg 6 21
6720
1
thg 11 22
6519
1
thg 10 21
3732
2
thg 11 18
10589