İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
4381 Görünümler


@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
Vazgeç
En İyi Yanıt

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

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
@api.constrains Çözüldü
2
Ara 23
3145
0
Haz 21
2587
2
Haz 20
3114
2
Mar 24
5541
1
Tem 23
1567