跳至内容
菜单
此问题已终结
1 回复
4481 查看


@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



形象
丢弃
最佳答案

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

形象
丢弃
相关帖文 回复 查看 活动
2
12月 23
3339
0
6月 21
2663
2
6月 20
3217
2
3月 24
5684
1
7月 23
1695