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


@onchange has self._origin to get previous values, but this is not available for @constrains.

How do you get the previous value of a field? This is most usefull sometimes when you want to add a constrain based on a previous value


Right now I'm solving this in the write() method by getting the value before and after calling super.write and then raising an UserError. Seems this would be better fit for constrains


Thanks



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

I go further and asks how to know if it is a newly created record from inside constrains decorator method?

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
@api.constrains Đã xử lý
2
thg 12 23
3189
0
thg 6 21
2605
2
thg 6 20
3135
2
thg 3 24
5585
1
thg 7 23
1592