Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
1 Antworten
4462 Ansichten


@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
Verwerfen
Beste Antwort

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

Avatar
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
2
Dez. 23
3308
0
Juni 21
2655
2
Juni 20
3210
2
März 24
5669
1
Juli 23
1691