Skip to Content
Menú
This question has been flagged
1 Respondre
4627 Vistes


@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



Avatar
Descartar
Best Answer

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

Avatar
Descartar
Related Posts Respostes Vistes Activitat
2
de des. 23
3638
0
de juny 21
2835
2
de juny 20
3395
2
de març 24
5918
1
de jul. 23
1883