Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
4480 Widoki


@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



Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
@api.constrains Rozwiązane
2
gru 23
3333
0
cze 21
2663
2
cze 20
3217
2
mar 24
5684
1
lip 23
1694