Se rendre au contenu
Menu
Cette question a été signalée
1 Répondre
4487 Vues


@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
Ignorer
Meilleure réponse

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

Avatar
Ignorer
Publications associées Réponses Vues Activité
2
déc. 23
3350
0
juin 21
2665
2
juin 20
3220
2
mars 24
5691
1
juil. 23
1696