Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
780 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
5181
0
thg 6 21
6367
1
thg 11 22
5635
1
thg 10 21
3299
2
thg 11 18
10204